View Issue Details

IDProjectCategoryView StatusLast Update
0027225LazarusWidgetsetpublic2019-11-27 22:44
ReporterCedric Assigned ToZeljan Rikalo  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformlinux /GTK3OSkubuntu 
Product Version1.2.7 (SVN) 
Summary0027225: [GTK3] RawImage_CreateBitmaps create every bitmap with alpha channel
Descriptionif i load a jpeg without alpha channel in a TPicture, RawImage_CreateBitmaps add an alpha channel.
TagsNo tags attached.
Fixed in Revision47267
LazTarget-
Widgetset
Attached Files

Relationships

related to 0036254 resolvedJuha Manninen gtk3: PNG images render badly 

Activities

Cedric

2014-12-30 14:10

reporter  

RawImage_CreateBitmaps.diff (1,481 bytes)   
Index: lcl/interfaces/gtk3/gtk3lclintf.inc
===================================================================
--- lcl/interfaces/gtk3/gtk3lclintf.inc	(révision 47265)
+++ lcl/interfaces/gtk3/gtk3lclintf.inc	(copie de travail)
@@ -234,8 +234,6 @@
   ARowStride: PtrUInt;
 begin
   Result := False;
-
-  Result := False;
   ABitmap := 0;
   AMask := 0;
 
@@ -251,9 +249,11 @@
   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));
Index: lcl/interfaces/gtk3/gtk3objects.pas
===================================================================
--- lcl/interfaces/gtk3/gtk3objects.pas	(révision 47265)
+++ lcl/interfaces/gtk3/gtk3objects.pas	(copie de travail)
@@ -639,7 +639,7 @@
     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;
RawImage_CreateBitmaps.diff (1,481 bytes)   

Zeljan Rikalo

2014-12-30 20:22

developer   ~0080036

Please close if ok.

Issue History

Date Modified Username Field Change
2014-12-30 14:10 Cedric New Issue
2014-12-30 14:10 Cedric File Added: RawImage_CreateBitmaps.diff
2014-12-30 16:36 Zeljan Rikalo Assigned To => Zeljan Rikalo
2014-12-30 16:36 Zeljan Rikalo Status new => assigned
2014-12-30 20:22 Zeljan Rikalo Fixed in Revision => 47267
2014-12-30 20:22 Zeljan Rikalo LazTarget => -
2014-12-30 20:22 Zeljan Rikalo Note Added: 0080036
2014-12-30 20:22 Zeljan Rikalo Status assigned => resolved
2014-12-30 20:22 Zeljan Rikalo Resolution open => fixed
2014-12-30 20:40 Cedric Status resolved => closed
2019-11-27 22:44 Juha Manninen Relationship added related to 0036254