比如clBtnFace这个颜色,如果直接给Image1.Canvas.Brush.Color的话就可以真的画出这个颜色,但如果用(ColorToRGB() + GetRValue() + GetGValue() + GetBValue())或GetNearestColor,更或是RGB(GetRValue() + GetGValue() + GetBValue()),得到的值再给Image1.Canvas.Brush.Color的话就会失真了。请问要如何能得到RGB的颜色,并对它进行操作后,又能转化为原来的16位色或32位色从而不失真呢?

解决方案 »

  1.   

    Image1.Canvas.Brush.Color:=RGB(,,);还有什么不能实现么?
      

  2.   

    var originalColor:TColor;red,blue,green,reserved:byte;
    originalColor:=ColorToRGB(Image1.Canvas.Brush.Color);
    red:=GetRValue(originalColor);
    blue:=GetBValue(originalColor);
    green:=GetGValue(originalColor);
    reserved:=Byte(DWORD(originalColor) shr 24);
    ................
    Image1.Canvas.Brush.Color:=(RGB(red,Green,Blue) or (reserved shl 24));没有测试
      

  3.   

    不要用GetRValue,直接在rgb中写值