- Timestamp:
- Apr 6, 2021, 8:11:02 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/Packages/CevoComponents/UPixelPointer.pas
r251 r349 13 13 14 14 TPixel32 = packed record 15 procedure SetRGB(Color: TColor32); 16 function GetRGB: TColor32; 15 private 16 function GetRGB: Cardinal; 17 procedure SetRGB(AValue: Cardinal); 18 public 19 property RGB: Cardinal read GetRGB write SetRGB; 17 20 case Integer of 18 21 0: (B, G, R, A: Byte); … … 42 45 43 46 function PixelPointer(Bitmap: TDpiRasterImage; BaseX: Integer = 0; BaseY: Integer = 0): TPixelPointer; inline; 47 function SwapRedBlue(Color: TColor32): TColor32; 44 48 function Color32ToColor(Color: TColor32): TColor; 45 49 function ColorToColor32(Color: TColor): TColor32; 46 47 50 48 51 implementation … … 50 53 { TPixel32 } 51 54 52 procedure TPixel32.SetRGB(Color: TColor32);55 function TPixel32.GetRGB: Cardinal; 53 56 begin 54 B := Color and $ff; 55 G := (Color shr 8) and $ff; 56 R := (Color shr 16) and $ff; 57 Result := ARGB and $ffffff; 57 58 end; 58 59 59 function TPixel32.GetRGB: TColor32;60 procedure TPixel32.SetRGB(AValue: Cardinal); 60 61 begin 61 Result := ARGB and $ffffff; 62 R := (AValue shr 16) and $ff; 63 G := (AValue shr 8) and $ff; 64 B := (AValue shr 0) and $ff; 62 65 end; 63 66 … … 107 110 end; 108 111 112 function SwapRedBlue(Color: TColor32): TColor32; 113 begin 114 Result := (Color and $ff00ff00) or ((Color and $ff) shl 16) or ((Color shr 16) and $ff); 115 end; 116 109 117 function Color32ToColor(Color: TColor32): TColor; 110 118 begin
Note:
See TracChangeset
for help on using the changeset viewer.