Changeset 494 for GraphicTest/Packages/bgrabitmap/bgragtkbitmap.pas
- Timestamp:
- Dec 22, 2016, 8:49:19 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GraphicTest/Packages/bgrabitmap/bgragtkbitmap.pas
r472 r494 28 28 29 29 uses 30 Classes, SysUtils, BGRA DefaultBitmap, Graphics,30 Classes, SysUtils, BGRALCLBitmap, Graphics, 31 31 GraphType; 32 32 … … 34 34 { TBGRAGtkBitmap } 35 35 36 TBGRAGtkBitmap = class(TBGRA DefaultBitmap)36 TBGRAGtkBitmap = class(TBGRALCLBitmap) 37 37 private 38 38 FPixBuf: Pointer; 39 { procedure SlowDrawTransparent(ABitmap: TBGRADefaultBitmap;40 ACanvas: TCanvas; ARect: TRect);}41 39 procedure DrawTransparent(ACanvas: TCanvas; Rect: TRect); 42 40 procedure DrawOpaque(ACanvas: TCanvas; Rect: TRect); … … 57 55 implementation 58 56 59 uses BGRABitmapTypes, LCLType,57 uses BGRABitmapTypes, BGRADefaultBitmap, LCLType, 60 58 LCLIntf, IntfGraphics, 61 59 {$IFDEF LCLgtk2} … … 70 68 type TGtkDeviceContext = TGtk2DeviceContext; 71 69 {$ENDIF} 72 73 {procedure TBGRAGtkBitmap.SlowDrawTransparent(ABitmap: TBGRADefaultBitmap;74 ACanvas: TCanvas; ARect: TRect);75 var76 background, temp: TBGRACustomBitmap;77 w, h: integer;78 79 begin80 w := ARect.Right - ARect.Left;81 h := ARect.Bottom - ARect.Top;82 background := NewBitmap(w, h);83 background.GetImageFromCanvas(ACanvas, ARect.Left, ARect.Top);84 if (ABitmap.Width = w) and (ABitmap.Height = h) then85 background.PutImage(0, 0, ABitmap, dmDrawWithTransparency)86 else87 begin88 temp := ABitmap.Resample(w, h, rmSimpleStretch);89 background.PutImage(0, 0, temp, dmDrawWithTransparency);90 temp.Free;91 end;92 background.Draw(ACanvas, ARect.Left, ARect.Top, True);93 background.Free;94 end;}95 70 96 71 procedure TBGRAGtkBitmap.ReallocData; … … 141 116 end; 142 117 143 SwapRedBlue;118 If not TBGRAPixel_RGBAOrder then SwapRedBlue; 144 119 145 120 P := Rect.TopLeft; … … 152 127 GDK_RGB_DITHER_NORMAL,0,0); 153 128 154 SwapRedBlue;129 If not TBGRAPixel_RGBAOrder then SwapRedBlue; 155 130 end; 156 131 … … 252 227 LPtoDP(dest, pos, 1); 253 228 If ALineOrder = riloBottomToTop then VerticalFlip; 254 SwapRedBlue;229 If not TBGRAPixel_RGBAOrder then SwapRedBlue; 255 230 gdk_draw_rgb_32_image(TGtkDeviceContext(dest).Drawable, 256 231 TGtkDeviceContext(Dest).GC, pos.x,pos.y, 257 232 AWidth,AHeight, GDK_RGB_DITHER_NORMAL, 258 233 AData, AWidth*sizeof(TBGRAPixel)); 259 SwapRedBlue;234 If not TBGRAPixel_RGBAOrder then SwapRedBlue; 260 235 If ALineOrder = riloBottomToTop then VerticalFlip; 261 236 end; … … 297 272 TGtkDeviceContext(CanvasSource.Handle).Drawable, 298 273 nil, P.X,P.Y,0,0,Width,Height); 299 SwapRedBlue;274 If not TBGRAPixel_RGBAOrder then SwapRedBlue; 300 275 InvalidateBitmap; 301 276 end;
Note:
See TracChangeset
for help on using the changeset viewer.