妖の僧的 Delphi 博客

记录学习过程中的点点滴滴,是喜欢,不是职业;记性不好,特别需要这么一个博客.

导航

TColor 与 RGB 的转换函数

function RGB2TColor(const R, G, B: Byte): Integer;
begin
  // convert hexa-decimal values to RGB
  Result := R + G shl 8 + B shl 16;
end;

procedure TColor2RGB(const Color: TColor; var R, G, B: Byte);
begin
  R := Color and $FF;
  G := (Color shr 8) and $FF;
  B := (Color shr 16) and $FF;
end;
//特地开计算器算了下,尼玛FF=255;

posted on 2015-03-14 17:04  妖の僧  阅读(507)  评论(0)    收藏  举报