Ignore:
Timestamp:
Nov 29, 2023, 2:35:44 PM (12 months ago)
Author:
chronos
Message:
  • Modified: HighDpi branch updated to trunk version.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Packages/Common/PixelPointer.pas

    r462 r463  
    1 unit UPixelPointer;
     1unit PixelPointer;
    22
    33interface
     
    1515  private
    1616    procedure SetRGB(AValue: Cardinal);
    17     function GetRGB: Cardinal;   
     17    function GetRGB: Cardinal;
    1818  public
    1919    property RGB: Cardinal read GetRGB write SetRGB;
     
    4141    procedure SetXY(X, Y: Integer); inline; // Set pixel position relative to base
    4242    procedure SetX(X: Integer); inline; // Set horizontal pixel position relative to base
     43    class function Create(Bitmap: TDpiRasterImage; BaseX: Integer = 0; BaseY: Integer = 0): TPixelPointer; inline; static;
    4344  end;
    4445  PPixelPointer = ^TPixelPointer;
    4546
    46   function PixelPointer(Bitmap: TDpiRasterImage; BaseX: Integer = 0; BaseY: Integer = 0): TPixelPointer; inline;
    4747  function SwapRedBlue(Color: TColor32): TColor32;
    4848  procedure BitmapCopyRect(DstBitmap: TDpiRasterImage; DstRect: TRect; SrcBitmap: TDpiRasterImage; SrcPos: TPoint);
     
    6060  function ColorToColor32(Color: TColor): TColor32;
    6161
     62
    6263implementation
    6364
     
    119120  SrcBitmap.BeginUpdate(True);
    120121  DstBitmap.BeginUpdate(True);
    121   SrcPtr := PixelPointer(SrcBitmap, SrcPos.X, SrcPos.Y);
    122   DstPtr := PixelPointer(DstBitmap, DstRect.Left, DstRect.Top);
     122  SrcPtr := TPixelPointer.Create(SrcBitmap, SrcPos.X, SrcPos.Y);
     123  DstPtr := TPixelPointer.Create(DstBitmap, DstRect.Left, DstRect.Top);
    123124  for Y := 0 to DstRect.Height - 1 do begin
    124125    for X := 0 to DstRect.Width - 1 do begin
     
    138139var
    139140  SrcPtr, DstPtr: TPixelPointer;
    140   SubPtr: TPixelPointer;
    141141  X, Y: Integer;
    142142  XX, YY: Integer;
     
    150150  SrcBitmap.BeginUpdate(True);
    151151  DstBitmap.BeginUpdate(True);
    152   SrcPtr := PixelPointer(SrcBitmap, SrcRect.Left, SrcRect.Top);
    153   DstPtr := PixelPointer(DstBitmap, DstRect.Left, DstRect.Top);
     152  SrcPtr := TPixelPointer.Create(SrcBitmap, SrcRect.Left, SrcRect.Top);
     153  DstPtr := TPixelPointer.Create(DstBitmap, DstRect.Left, DstRect.Top);
    154154  for Y := 0 to DstRect.Height - 1 do begin
    155155    for X := 0 to DstRect.Width - 1 do begin
     
    181181begin
    182182  Bitmap.BeginUpdate(True);
    183   Ptr := PixelPointer(Bitmap);
     183  Ptr := TPixelPointer.Create(Bitmap);
    184184  for Y := 0 to Bitmap.Height - 1 do begin
    185185    for X := 0 to Bitmap.Width - 1 do begin
     
    198198begin
    199199  Bitmap.BeginUpdate(True);
    200   Ptr := PixelPointer(Bitmap, Rect.Left, Rect.Top);
     200  Ptr := TPixelPointer.Create(Bitmap, Rect.Left, Rect.Top);
    201201  for Y := 0 to Rect.Height - 1 do begin
    202202    for X := 0 to Rect.Width - 1 do begin
     
    215215begin
    216216  Bitmap.BeginUpdate(True);
    217   Ptr := PixelPointer(Bitmap);
     217  Ptr := TPixelPointer.Create(Bitmap);
    218218  for Y := 0 to Bitmap.Height - 1 do begin
    219219    for X := 0 to Bitmap.Width - 1 do begin
     
    232232begin
    233233  Bitmap.BeginUpdate(True);
    234   Ptr := PixelPointer(Bitmap);
     234  Ptr := TPixelPointer.Create(Bitmap);
    235235  for Y := 0 to Bitmap.Height - 1 do begin
    236236    for X := 0 to Bitmap.Width - 1 do begin
     
    252252  Pixel := Color32ToPixel32(Color);
    253253  Bitmap.BeginUpdate(True);
    254   Ptr := PixelPointer(Bitmap);
     254  Ptr := TPixelPointer.Create(Bitmap);
    255255  for Y := 0 to Bitmap.Height - 1 do begin
    256256    for X := 0 to Bitmap.Width - 1 do begin
     
    295295end;
    296296
    297 function PixelPointer(Bitmap: TDpiRasterImage; BaseX: Integer;
     297class function TPixelPointer.Create(Bitmap: TDpiRasterImage; BaseX: Integer;
    298298  BaseY: Integer): TPixelPointer;
    299299begin
     
    310310end;
    311311
    312 
    313312end.
    314 
Note: See TracChangeset for help on using the changeset viewer.