Ignore:
Timestamp:
Dec 22, 2016, 8:49:19 PM (7 years ago)
Author:
chronos
Message:
  • Modified: Updated BGRABitmap package.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GraphicTest/Packages/bgrabitmap/bgragtkbitmap.pas

    r472 r494  
    2828
    2929uses
    30   Classes, SysUtils, BGRADefaultBitmap, Graphics,
     30  Classes, SysUtils, BGRALCLBitmap, Graphics,
    3131  GraphType;
    3232
     
    3434  { TBGRAGtkBitmap }
    3535
    36   TBGRAGtkBitmap = class(TBGRADefaultBitmap)
     36  TBGRAGtkBitmap = class(TBGRALCLBitmap)
    3737  private
    3838    FPixBuf: Pointer;
    39 {    procedure SlowDrawTransparent(ABitmap: TBGRADefaultBitmap;
    40       ACanvas: TCanvas; ARect: TRect);}
    4139    procedure DrawTransparent(ACanvas: TCanvas; Rect: TRect);
    4240    procedure DrawOpaque(ACanvas: TCanvas; Rect: TRect);
     
    5755implementation
    5856
    59 uses BGRABitmapTypes, LCLType,
     57uses BGRABitmapTypes, BGRADefaultBitmap, LCLType,
    6058  LCLIntf, IntfGraphics,
    6159  {$IFDEF LCLgtk2}
     
    7068type TGtkDeviceContext = TGtk2DeviceContext;
    7169{$ENDIF}
    72 
    73 {procedure TBGRAGtkBitmap.SlowDrawTransparent(ABitmap: TBGRADefaultBitmap;
    74   ACanvas: TCanvas; ARect: TRect);
    75 var
    76   background, temp: TBGRACustomBitmap;
    77   w, h: integer;
    78 
    79 begin
    80   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) then
    85     background.PutImage(0, 0, ABitmap, dmDrawWithTransparency)
    86   else
    87   begin
    88     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;}
    9570
    9671procedure TBGRAGtkBitmap.ReallocData;
     
    141116  end;
    142117
    143   SwapRedBlue;
     118  If not TBGRAPixel_RGBAOrder then SwapRedBlue;
    144119 
    145120  P := Rect.TopLeft;
     
    152127    GDK_RGB_DITHER_NORMAL,0,0);   
    153128
    154   SwapRedBlue;
     129  If not TBGRAPixel_RGBAOrder then SwapRedBlue;
    155130end;
    156131
     
    252227  LPtoDP(dest, pos, 1);
    253228  If ALineOrder = riloBottomToTop then VerticalFlip;
    254   SwapRedBlue;
     229  If not TBGRAPixel_RGBAOrder then SwapRedBlue;
    255230  gdk_draw_rgb_32_image(TGtkDeviceContext(dest).Drawable,
    256231    TGtkDeviceContext(Dest).GC, pos.x,pos.y,
    257232    AWidth,AHeight, GDK_RGB_DITHER_NORMAL,
    258233    AData, AWidth*sizeof(TBGRAPixel));
    259   SwapRedBlue;
     234  If not TBGRAPixel_RGBAOrder then SwapRedBlue;
    260235  If ALineOrder = riloBottomToTop then VerticalFlip;
    261236end;
     
    297272    TGtkDeviceContext(CanvasSource.Handle).Drawable,
    298273    nil, P.X,P.Y,0,0,Width,Height);
    299   SwapRedBlue;
     274  If not TBGRAPixel_RGBAOrder then SwapRedBlue;
    300275  InvalidateBitmap;
    301276end;
Note: See TracChangeset for help on using the changeset viewer.