[fpc-pascal] TFPColor vs TColor

David Emerson dle3ab at angelbase.com
Fri May 8 00:26:52 CEST 2009


Incidentally, while working with the TfpgColor type, I've come up with a 
rather sloppy, but (for the time being) usable solution. I keep 
a "fixme" comment in the code, because it may very well blow up in my 
face sometime.

type
  TfpgIntColor = TfpgColor;
  TfpgRecordColor = record
    blue, green, red, alpha : byte;  // order is important
    end;

operator := (c_in : TfpgRecordColor) : TfpgIntColor;
  var
    p : pointer;
  begin
    p := @c_in;
    result := TfpgIntColor (p^);
  end;

operator := (c_in : TfpgIntColor) : TfpgRecordColor 
  var
    p : pointer;
  begin
    p := @c_in;
    result := TfpgRecordColor (p^);
  end;


~David.




More information about the fpc-pascal mailing list