TatukGIS - GisDefs - ColorToHSL 過程

過程名稱  ColorToHSLspa

所在單元  GisDefs code

過程原型  orm

          procedure ColorToHSL(const _color: TColor; var _h: Real; var _s: Real; var _l: Real);         xml

過程說明 blog

   根據TColor 轉換至 HSL顏色.   ip

         HSL即色相飽和度亮度英語Hue, Saturation, Lightness),又稱HLS          get

舉例說明    原型

 
 1 var
 2   h, s, l: Real;
 3   c: TColor;
 4 begin
 5   c := RGBToColor(127,255,127);
 6   ColorToHSL(c, h, s, l);
 7   ShowMessage(Format('H = %f , S = %f , L = %f', [h*360, s, l]));
 8   c := HSLToColor(h, s, l);
 9   ShowMessage(IntToStr(c));
10   if c = RGBToColor(127,255,127) then ShowMessage('OK');
11 end;
 

 

RGB HSL HSV 結果
(1, 0, 0) (0°, 1, 0.5) (0°, 1, 1)  
(0.5, 1, 0.5) (120°, 1, 0.75) (120°, 0.5, 1)  
(0, 0, 0.5) (240°, 1, 0.25) (240°, 1, 0.5)
相關文章
相關標籤/搜索