gtk3: create bitmap with alpha channel. Patch by Cedric. issue #27225.

git-svn-id: trunk@47267 -
This commit is contained in:
zeljko 2014-12-30 19:22:11 +00:00
parent e21663d02d
commit 9cd3560b15
2 changed files with 5 additions and 5 deletions

View File

@ -233,8 +233,6 @@ var
ImageFormat: cairo_format_t;
ARowStride: PtrUInt;
begin
Result := False;
Result := False;
ABitmap := 0;
AMask := 0;
@ -251,9 +249,11 @@ begin
case Desc.Depth of
1: ImageFormat := CAIRO_FORMAT_A1;
2: ImageFormat := CAIRO_FORMAT_A8;
24: ImageFormat := CAIRO_FORMAT_RGB24;
else
ImageFormat := CAIRO_FORMAT_ARGB32;
if Desc.AlphaPrec=0 then
ImageFormat := CAIRO_FORMAT_RGB24
else
ImageFormat := CAIRO_FORMAT_ARGB32;
end;
ARowStride := GetBytesPerLine(Desc.Width, Desc.BitsPerPixel, rileDWordBoundary);
ABitmap := HBitmap(TGtk3Image.Create(NewData, Desc.Width, Desc.Height, ARowStride, ImageFormat, True));

View File

@ -639,7 +639,7 @@ begin
gdk_pixbuf_fill(FHandle, 0);
end else
begin
FHandle := TGdkPixbuf.new_from_data(AData, GDK_COLORSPACE_RGB, True, 8, width, height, bytesPerLine, nil, nil);
FHandle := TGdkPixbuf.new_from_data(AData, GDK_COLORSPACE_RGB, format=CAIRO_FORMAT_ARGB32, 8, width, height, bytesPerLine, nil, nil);
end;
end;