Recent

Author Topic: Resize images in TImageList under Linux  (Read 1376 times)

Chronos

  • Full Member
  • ***
  • Posts: 207
    • PascalClassLibrary
Resize images in TImageList under Linux
« on: March 27, 2018, 04:21:10 pm »
I put a code for resizing images inside TImageList into wiki here: http://wiki.freepascal.org/TImageList#Resize_all_images_in_TImageList
It works under Windows but not under Linux. The question is how to make it work under Linux GTK2. I didn't test it under Qt.

If PixelFormat of temporary bitmaps is set to pf24bit or pfDevice then images are resized under Linux but transparency doesn't work for them. I tried to set TransparentColor and other properites but without desired effect. It seems that transparency is handled somehow differently under Gtk2 widgedset. Or it may be just because under linux 24-bit colors are used.

Test project is attached bellow.



wp

  • Hero Member
  • *****
  • Posts: 5996
Re: Resize images in TImageList under Linux
« Reply #1 on: March 27, 2018, 04:45:06 pm »
This article is very misleading. Support for mutliple image sizes and resizing has been built into trunk in a very elegant and transparent way. Did you read http://wiki.freepascal.org/TImageList#Multiple-resolution_TImageList_in_Lazarus_1.9_and_newer right above your text?
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

Chronos

  • Full Member
  • ***
  • Posts: 207
    • PascalClassLibrary
Re: Resize images in TImageList under Linux
« Reply #2 on: March 30, 2018, 11:50:41 am »
Yes, I noticed that and also that it is for Lazarus 1.9 which is not a stable version and won't come in near future as a stable version. So it isn't usable for me. Also I don't want to supply multiple icons for multiple resolutions. I just want to resize my current icons. Resizing TImageList images may not be needed just for High DPI scaling but for other purpose.

So back to my question. How to do that in multi-platform way? It seems that TImageList internals are pretty complicated. That it isn't just one combined bitmap but it also depends heavily on the widgetset. The main problem is that methods Add/Insert/InternalInsert don't work correctly with a transparent image under gtk2. And I don't know how to fix that.