Ignore:
Timestamp:
Apr 6, 2021, 8:11:02 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Merged trunk branch version r348 into highdpi branch.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Packages/CevoComponents/UPixelPointer.pas

    r251 r349  
    1313
    1414  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;
    1720    case Integer of
    1821      0: (B, G, R, A: Byte);
     
    4245
    4346  function PixelPointer(Bitmap: TDpiRasterImage; BaseX: Integer = 0; BaseY: Integer = 0): TPixelPointer; inline;
     47  function SwapRedBlue(Color: TColor32): TColor32;
    4448  function Color32ToColor(Color: TColor32): TColor;
    4549  function ColorToColor32(Color: TColor): TColor32;
    46 
    4750
    4851implementation
     
    5053{ TPixel32 }
    5154
    52 procedure TPixel32.SetRGB(Color: TColor32);
     55function TPixel32.GetRGB: Cardinal;
    5356begin
    54   B := Color and $ff;
    55   G := (Color shr 8) and $ff;
    56   R := (Color shr 16) and $ff;
     57  Result := ARGB and $ffffff;
    5758end;
    5859
    59 function TPixel32.GetRGB: TColor32;
     60procedure TPixel32.SetRGB(AValue: Cardinal);
    6061begin
    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;
    6265end;
    6366
     
    107110end;
    108111
     112function SwapRedBlue(Color: TColor32): TColor32;
     113begin
     114  Result := (Color and $ff00ff00) or ((Color and $ff) shl 16) or ((Color shr 16) and $ff);
     115end;
     116
    109117function Color32ToColor(Color: TColor32): TColor;
    110118begin
Note: See TracChangeset for help on using the changeset viewer.