Changeset 27 for trunk/Packages
- Timestamp:
- Dec 22, 2016, 5:35:25 PM (8 years ago)
- Location:
- trunk/Packages/FastGraphics
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/FastGraphics/ColorFormats/UColorRGB8.pas
r26 r27 54 54 procedure PaintToCanvas(Canvas: TCanvas); override; 55 55 procedure PaintToCanvas(Canvas: TCanvas; Rect: TRect); override; 56 procedure PaintToBitmap(Bitmap: TBitmap; Rect: TRect); override; 56 57 procedure LoadFromCanvas(Canvas: TCanvas); override; 57 58 function GetDataSize: Integer; override; … … 91 92 function TPixmapRGB8.RGB8ToColor(Value: TColorRGB8): TColor; 92 93 begin 93 Result := (Value. R shl 16) or (Value.G shl 8) or (Value.Bshl 0);94 Result := (Value.B shl 16) or (Value.G shl 8) or (Value.R shl 0); 94 95 end; 95 96 … … 159 160 end; 160 161 162 procedure TBPixmapRGB8.PaintToBitmap(Bitmap: TBitmap; Rect: TRect); 163 begin 164 Pixmap.PaintToBitmap(Bitmap, Rect, Pixmap.RGB8ToColor); 165 end; 166 161 167 procedure TBPixmapRGB8.LoadFromCanvas(Canvas: TCanvas); 162 168 begin -
trunk/Packages/FastGraphics/UFGraphics.pas
r26 r27 43 43 procedure PaintToCanvas(Canvas: TCanvas); virtual; overload; 44 44 procedure PaintToCanvas(Canvas: TCanvas; Rect: TRect); virtual; overload; 45 procedure PaintToBitmap(Bitmap: TBitmap; Rect: TRect); virtual; 45 46 procedure LoadFromCanvas(Canvas: TCanvas); virtual; 46 47 function GetDataSize: Integer; virtual; … … 171 172 procedure PaintToCanvas(Canvas: TCanvas); overload; 172 173 procedure PaintToCanvas(Canvas: TCanvas; Rect: TRect); overload; 174 procedure PaintToBitmap(Bitmap: TBitmap; Rect: TRect); overload; 173 175 procedure LoadFromCanvas(Canvas: TCanvas); 174 176 function GetDataSize: Integer; … … 373 375 end; 374 376 377 procedure TBImage.PaintToBitmap(Bitmap: TBitmap; Rect: TRect); 378 begin 379 end; 380 375 381 procedure TBImage.LoadFromCanvas(Canvas: TCanvas); 376 382 begin … … 479 485 begin 480 486 FBackend.PaintToCanvas(Canvas, Rect); 487 end; 488 489 procedure TFPixmap.PaintToBitmap(Bitmap: TBitmap; Rect: TRect); 490 begin 491 FBackend.PaintToBitmap(Bitmap, Rect); 481 492 end; 482 493 -
trunk/Packages/FastGraphics/UGGraphics.pas
r26 r27 6 6 7 7 uses 8 Classes, SysUtils, Graphics ;8 Classes, SysUtils, Graphics, GraphType; 9 9 10 10 type … … 66 66 procedure PaintToCanvas(Canvas: TCanvas; ColorConvertFunc: TGConvertColor); overload; 67 67 procedure PaintToCanvas(Canvas: TCanvas; Rect: TRect; ColorConvertFunc: TGConvertColor); overload; 68 procedure PaintToBitmap(Bitmap: TBitmap; Rect: TRect; ColorConvertFunc: TGConvertColor); 68 69 procedure LoadFromCanvas(Canvas: TCanvas; ColorConvertFunc: TGConvertFromColor); overload; 69 70 procedure Fill(Color: TGColor); overload; … … 191 192 end; 192 193 194 procedure TGPixmap<TGColor>.PaintToBitmap(Bitmap: TBitmap; Rect: TRect; 195 ColorConvertFunc: TGConvertColor); 196 var 197 X, Y: Integer; 198 PixelPtr: PInteger; 199 PixelPtrMax: PInteger; 200 PixelRowPtr: PInteger; 201 P: TPixelFormat; 202 RawImage: TRawImage; 203 BytePerPixel: Integer; 204 begin 205 try 206 Bitmap.BeginUpdate(False); 207 RawImage := Bitmap.RawImage; 208 PixelRowPtr := PInteger(RawImage.Data); 209 BytePerPixel := RawImage.Description.BitsPerPixel div 8; 210 PixelPtrMax := PixelRowPtr + RawImage.Description.Width * RawImage.Description.Height * BytePerPixel; 211 for Y := Rect.Top to Rect.Bottom - 1 do begin 212 PixelPtr := PixelRowPtr; 213 for X := Rect.Left to Rect.Right - 1 do begin 214 if (X >= 0) and (X < FSize.X) and (Y >= 0) and (Y < FSize.Y) and (PixelPtr < PixelPtrMax) then 215 PixelPtr^ := ColorConvertFunc(Pixels[X, Y]); 216 Inc(PByte(PixelPtr), BytePerPixel); 217 218 end; 219 Inc(PByte(PixelRowPtr), RawImage.Description.BytesPerLine); 220 end; 221 finally 222 Bitmap.EndUpdate(False); 223 end; 224 end; 225 193 226 procedure TGPixmap<TGColor>.LoadFromCanvas(Canvas: TCanvas; ColorConvertFunc: TGConvertFromColor); overload; 194 227 var
Note:
See TracChangeset
for help on using the changeset viewer.