GTK3 distorts colors? lazarus / 31-LCL ---------------------------------------------------------------------- wschulte · 2022-10-31 05:36 When using the LoadFromFile method from TPicture I get totally wrong colors when compiling with the GTK3 widget-set. See gtk3.jpg. When compiling for GTK2 is displays normal (gtk2.jpg). What am I doing wrong ? Attached the sources in problemsrc.zip. BTW. also in QT5 the picture displays normal. It is only in GTK3 that the colors get weird. FPC 3.2.2 Lazarus 2.2.2.0 libgtk-3.so.0.2404.16 Distro: Linux Mint 20.3 Una ---------------------------------------------------------------------- bytebites · 2022-10-31 06:32 widgets_unit.pas" was not found ---------------------------------------------------------------------- dseligo · 2022-10-31 06:45 It looks like red and blue are mutally changed. ---------------------------------------------------------------------- winni · 2022-10-31 11:25 Already in the bugreports: https://bugs.openjdk.org/browse/JDK-8271398?attachmentSortBy=dateTime ---------------------------------------------------------------------- Zoran · 2022-10-31 11:44 Quote from: winni on October 31, 2022, 12:25:16 pmAlready in the bugreports: https://bugs.openjdk.org/browse/JDK-8271398?attachmentSortBy=dateTime But... this is JDK bugreports?! ---------------------------------------------------------------------- Thaddy · 2022-10-31 12:01 Indeed, this is not related to FPC or Lazarus. ---------------------------------------------------------------------- wschulte · 2022-11-01 05:15 Quote from: bytebites on October 31, 2022, 07:32:37 amwidgets_unit.pas" was not found Sorry,  forgot those 2. They are in this attachment. ---------------------------------------------------------------------- wschulte · 2022-11-01 05:30 Quote from: Thaddy on October 31, 2022, 01:01:32 pmIndeed, this is not related to FPC or Lazarus. When searching for my problem, I found indeed another case of swapped channels in GTK4, but it was related to PNG (https://gitlab.gnome.org/GNOME/gtk/-/issues/4616). Somehow I thought it unrelated to my issue, but now .. it looks the same. Though I find it peculiar that I am the first one to stumble over this in Lazarus. So I guess also GTK4 has the same issue. ---------------------------------------------------------------------- wschulte · 2022-11-01 09:14 Did some further research with the same program as from post #6 and it gets a bit confusing. I tried to load some different graphical formats from the same picture, converted with GIMP to other formats. In GTK2 all pictures display normal, but on GTK3: .jpg gets displayed distorted, probably the blue and red channel are swapped.png either gets displayed distorted as the .jpg or not displayed at all. Looks like it depends on the size of the picture: small ones were displayed, albeit distorted, bigger ones (like my trial pic) didn't get displayed at all without any warning..ico gets displayed okay !.bmp becomes a totally weird picture on display I am a complete layman when it comes to graphical formats so I attach the base picture here (poep.jpg), which I used to produce the other formats. Perhaps important too: when I run the program in with GTK3 it produces a huge amount of output to stdout of what looks like debug messages: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i FocusedGtkEventResize: Form1:TForm1 Send=0 x=757 y=365 w=200 h=200other changes state=00015480 mask=00015400GtkEventResize: Form1:TForm1 Send=1 x=757 y=365 w=200 h=200GtkEventResize: Form1:TForm1 Send=1 x=757 y=365 w=200 h=200GtkEventResize: Form1:TForm1 Send=0 x=757 y=365 w=309 h=362GetStyleWithName creating style widget memoGtkEventResize: Form1:TForm1 Send=1 x=758 y=365 w=309 h=362GtkEventResize: Form1:TForm1 Send=1 x=758 y=366 w=309 h=362GtkEventResize: Form1:TForm1 Send=1 x=758 y=367 w=309 h=362GtkEventResize: Form1:TForm1 Send=1 x=758 y=368 w=309 h=362GtkEventResize: Form1:TForm1 Send=1 x=758 y=369 w=309 h=362  Do I have the right GTK3 library (3.24.0 in the repository) ? I downloaded it from the standard repository of Mint ... ---------------------------------------------------------------------- AmatCoder · 2022-11-01 10:54 Quote from: wschulte on October 31, 2022, 06:36:32 amWhen using the LoadFromFile method from TPicture I get totally wrong colors when compiling with the GTK3 widget-set. See gtk3.jpg. When compiling for GTK2 is displays normal (gtk2.jpg). What am I doing wrong ? You are doing nothing wrong. Just the LCL-Gtk3 implementation from Lazarus is buggy and/or incomplete. This confuses you because you are thinking: "...if works with Gtk2 then it should work with Gtk3..." But they are completely different for drawing: Gtk2 uses the old GDK drawing API. Gtk3 uses Cairo. Edit: A quick example. No support for RGB formats here.