mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
parent
b9d422290e
commit
f57be5f9b0
2 changed files with 17 additions and 13 deletions
|
|
@ -8,6 +8,7 @@ uses
|
|||
Classes, SysUtils, Graphics, IntfGraphics,
|
||||
gtk2def, gdk2pixbuf, gdk2, glib2;
|
||||
|
||||
function ImageToPixBuf(Image: TLazIntfImage): PGdkPixbuf;
|
||||
procedure DrawPixbufAtCanvas(Canvas: TCanvas; Pixbuf : PGdkPixbuf; SrcX, SrcY, DstX, DstY, Width, Height: Integer);
|
||||
function PixBufToBitmap(Pixbuf: PGdkPixbuf): TBitmap;
|
||||
|
||||
|
|
@ -103,20 +104,20 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
// or use this
|
||||
{
|
||||
procedure GdkPixbufDestroy(pixels: Pguchar; data: gpointer); cdecl;
|
||||
begin
|
||||
iPixbufWidth := gdk_pixbuf_get_width(pbPicture);
|
||||
iPixbufHeight := gdk_pixbuf_get_height(pbPicture);
|
||||
|
||||
Result := TBitMap.Create;
|
||||
Result.SetSize(iPixbufWidth, iPixbufHeight);
|
||||
Result.Canvas.Brush.Color := clBackColor;
|
||||
Result.Canvas.FillRect(0, 0, iPixbufWidth, iPixbufHeight);
|
||||
|
||||
DrawPixbufAtCanvas(Result.Canvas, pbPicture, 0, 0, 0, 0, iPixbufWidth, iPixbufHeight);
|
||||
PRawImage(data)^.FreeData;
|
||||
Dispose(PRawImage(data));
|
||||
end;
|
||||
|
||||
function ImageToPixBuf(Image: TLazIntfImage): PGdkPixbuf;
|
||||
var
|
||||
ARawImage: PRawImage;
|
||||
begin
|
||||
New(ARawImage);
|
||||
Image.GetRawImage(ARawImage^, True);
|
||||
Result:= gdk_pixbuf_new_from_data(Image.PixelData, GDK_COLORSPACE_RGB, True, 8, Image.Width, Image.Height, Image.Width * 4, @GdkPixbufDestroy, ARawImage);
|
||||
end;
|
||||
}
|
||||
|
||||
end.
|
||||
|
||||
|
|
|
|||
|
|
@ -776,10 +776,13 @@ begin
|
|||
finally
|
||||
ABitmap.Free;
|
||||
end;
|
||||
|
||||
{$IF DEFINED(LCLGTK2)}
|
||||
Result := FPixmapList.Add(ImageToPixBuf(Target));
|
||||
AIcon.Free;
|
||||
{$ELSE}
|
||||
BitmapAssign(AIcon, Target);
|
||||
|
||||
Result := FPixmapList.Add(AIcon);
|
||||
{$ENDIF}
|
||||
finally
|
||||
Target.Free;
|
||||
end;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue