Changeset 539 for trunk/Packages/Common
- Timestamp:
- Apr 16, 2024, 11:43:51 AM (7 months ago)
- Location:
- trunk/Packages/Common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/Languages/PixelPointer.pot
r506 r539 4 4 #: pixelpointer.soutofrange 5 5 #, object-pascal-format 6 msgid "Pixel pointer out of range [X: %d . Y: %d]"6 msgid "Pixel pointer out of range [X: %d, Y: %d, Width: %d, Height: %d]" 7 7 msgstr "" 8 8 -
trunk/Packages/Common/PixelPointer.pas
r506 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; … … 93 94 94 95 resourcestring 95 SOutOfRange = 'Pixel pointer out of range [X: %d . Y: %d]';96 SOutOfRange = 'Pixel pointer out of range [X: %d, Y: %d, Width: %d, Height: %d]'; 96 97 SWrongBitmapSize = 'Wrong bitmap size [width: %d, height: %d]'; 97 98 … … 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 … … 159 158 X := X - Y * BytesPerLine; 160 159 X := Floor(X / BytesPerPixel); 161 raise Exception.Create(Format(SOutOfRange, [X, Y ]));160 raise Exception.Create(Format(SOutOfRange, [X, Y, Width, Height])); 162 161 end; 163 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)); 164 169 end; 165 170
Note:
See TracChangeset
for help on using the changeset viewer.