Changeset 539 for trunk/Packages/DpiControls/Dpi.PixelPointer.pas
- Timestamp:
- Apr 16, 2024, 11:43:51 AM (4 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/DpiControls/Dpi.PixelPointer.pas
r538 r539 34 34 function GetPixelB: Byte; inline; 35 35 function GetPixelG: Byte; inline; 36 function GetPixelPlane(Index: Byte): Byte; 36 function GetPixelPlane(Index: Byte): Byte; inline; 37 37 function GetPixelR: Byte; inline; 38 38 function GetPixelA: Byte; inline; 39 39 function GetPixelPlanes: TColor32Planes; 40 function GetPixelRGB: Cardinal; 40 function GetPixelRGB: Cardinal; inline; 41 41 procedure SetPixelARGB(Value: TColor32); inline; 42 42 procedure SetPixelB(Value: Byte); inline; 43 43 procedure SetPixelG(Value: Byte); inline; 44 procedure SetPixelPlane(Index: Byte; AValue: Byte); 44 procedure SetPixelPlane(Index: Byte; AValue: Byte); inline; 45 45 procedure SetPixelR(Value: Byte); inline; 46 46 procedure SetPixelA(Value: Byte); inline; 47 procedure SetPixelRGB(Value: Cardinal); 47 procedure SetPixelRGB(Value: Cardinal); inline; 48 48 public 49 49 Base: PPixel32; … … 63 63 procedure SetX(X: Integer); inline; // Set horizontal pixel position relative to base 64 64 procedure CheckRange; inline; // Check if current pixel position is not out of range 65 function PosValid: Boolean; 65 66 class function Create(Bitmap: TRasterImage; BaseX: Integer = 0; BaseY: Integer = 0): TPixelPointer; static; 66 67 property PixelARGB: TColor32 read GetPixelARGB write SetPixelARGB; … … 105 106 procedure TPixel32.SetRGB(AValue: Cardinal); 106 107 begin 107 R := (AValue shr 16) and $ff; 108 G := (AValue shr 8) and $ff; 109 B := (AValue shr 0) and $ff; 108 ARGB := (ARGB and $ff000000) or (AValue and $ffffff); 110 109 end; 111 110 … … 148 147 {$IFOPT R+} 149 148 var 150 B: Integer;151 149 X: Integer; 152 150 Y: Integer; … … 156 154 if (PByte(Pixel) < PByte(Data)) or 157 155 (PByte(Pixel) >= PByte(Data) + Height * BytesPerLine) then begin 158 B:= PByte(Pixel) - PByte(Data);159 Y := Floor( B/ BytesPerLine);160 X := B- Y * BytesPerLine;156 X := PByte(Pixel) - PByte(Data); 157 Y := Floor(X / BytesPerLine); 158 X := X - Y * BytesPerLine; 161 159 X := Floor(X / BytesPerPixel); 162 160 raise Exception.Create(Format(SOutOfRange, [X, Y, Width, Height])); 163 161 end; 164 162 {$ENDIF} 163 end; 164 165 function TPixelPointer.PosValid: Boolean; 166 begin 167 Result := not ((PByte(Pixel) < PByte(Data)) or 168 (PByte(Pixel) >= PByte(Data) + Height * BytesPerLine)); 165 169 end; 166 170
Note:
See TracChangeset
for help on using the changeset viewer.