Hi,
I have application where user can choose size of toolbars, i.e. I have several image lists named IL16, IL20, IL24, IL32, IL48 and I switch them in property TToolBar.Images. In meanwhile, TImageList was redesigned to work with hi-DPI desktops. Now, I can load more images to each imagelist, with suffix _150 and _200. But it will cause dupicities, because icon16_150 and icon16_200 will have size 24 and 32 respectively, which are already stored in IL24 and IL32.
Question is: how can I do it without duplicities?
Thanks, V.
Mailing lists / lazarus / 2018-05
New Image Lists question
14 messages · 3 people ·
- OOndrej Pokorny 7
- VVojtěch Čihák 6
- MMattias Gaertner 1
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Vojtěch Čihák wroteI have application where user can choose size of toolbars, i.e. I have several image lists named IL16, IL20, IL24, IL32, IL48 and I switch them in property TToolBar.Images. In meanwhile, TImageList was redesigned to work with hi-DPI desktops. Now, I can load more images to each imagelist, with suffix _150 and _200. But it will cause dupicities, because icon16_150 and icon16_200 will have size 24 and 32 respectively, which are already stored in IL24 and IL32. Question is: how can I do it without duplicities?
You don't need several image lists any more. Delete IL20, IL24, IL32 and IL48 use only IL16 where you load all the images.
Read:
http://wiki.freepascal.org/Lazarus_1.10.0_release_notes#TCustomImageList_.2F_TImageList http://wiki.freepascal.org/TImageList
Demos:
examples/imagelist_highdpi_designtime
examples/imagelist_highdpi_runtime
Ondrej
I forgot: you will probably want to use TImageList.OnGetWidthForPPI so that the original resolution 32px is used for 20px images on 150% instead of 30px (20*1.5 = 30). See the
examples/imagelist_highdpi_designtime demo.
Ondrej
You don't need several image lists any more. Delete IL20, IL24, IL32 and IL48 use only…
[...] Demos: examples/imagelist_highdpi_runtime
Can you add some comments please?
Mattias
I have application where user can choose size of toolbars, i.e. I have several image…
Thanks, I saw the demos, I see now how it works. But how can I add multiple resolution to ImageList? Is it possible only with suffixes and all images must be in the same directory? I need to push 10 resolution to one ImageList. Default res. is 16x16 and the others are 20, 24, 28, 32, 40, 48, 56, 64 and 80. How should I do it?
V.
______________________________________________________________
Show quoted text 5 lines
Vojtěch Čihák wroteI have application where user can choose size of toolbars, i.e. I have several image lists named IL16, IL20, IL24, IL32, IL48 and I switch them in property TToolBar.Images. In meanwhile, TImageList was redesigned to work with hi-DPI desktops. Now, I can load more images to each imagelist, with suffix _150 and _200. But it will cause dupicities, because icon16_150 and icon16_200 will have size 24 and 32 respectively, which are already stored in IL24 and IL32. Question is: how can I do it without duplicities?
You don't need several image lists any more. Delete IL20, IL24, IL32 and IL48 use only IL16 where you load all the images.
Read:
http://wiki.freepascal.org/Lazarus_1.10.0_release_notes#TCustomImageList_.2F_TImageList <http://wiki.freepascal.org/Lazarus_1.10.0_release_notes#TCustomImageList_.2F_TImageList> http://wiki.freepascal.org/TImageList <http://wiki.freepascal.org/TImageList>
Demos:
examples/imagelist_highdpi_designtime
examples/imagelist_highdpi_runtime
Ondrej
Vojtěch Čihák wrote 9 lines
See the demo examples/imagelist_highdpi_runtime again.
Ondrej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180523/d4082ccb/attachment-0001.html>
Thanks, I saw the demos, I see now how it works. But how can I add multiple resolution to…
Vojtěch Čihák wrote 9 lines
Btw. for so many resolutions, I would just add 16x16 and then e.g. 128x128 or 256x256 and let the other resolutions get scaled automatically by the LCL.
If 20x20 and 24x24 shouldn't scale nicely from the high resolution, you may want to add them explicitely as well.
Ondrej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180523/5aef75a9/attachment.html>
Thanks, I saw the demos, I see now how it works. But how can I add multiple resolution to…
But I need to add images at design-time via Image List Editor. I have my images at *.svg format and I use script for converting (I use rsvg tool).
#!/bin/bash
for i in *.[Ss][Vv][Gg]; do rsvg-convert $i -w 80 -h 80 -a -o ../png80/`echo $i | sed -e 's/svg$/png/'`; done
for i in *.[Ss][Vv][Gg]; do rsvg-convert $i -w 64 -h 64 -a -o ../png64/`echo $i | sed -e 's/svg$/png/'`; done
for i in *.[Ss][Vv][Gg]; do rsvg-convert $i -w 56 -h 56 -a -o ../png56/`echo $i | sed -e 's/svg$/png/'`; done
for i in *.[Ss][Vv][Gg]; do rsvg-convert $i -w 48 -h 48 -a -o ../png48/`echo $i | sed -e 's/svg$/png/'`; done
for i in *.[Ss][Vv][Gg]; do rsvg-convert $i -w 40 -h 40 -a -o ../png40/`echo $i | sed -e 's/svg$/png/'`; done
for i in *.[Ss][Vv][Gg]; do rsvg-convert $i -w 32 -h 32 -a -o ../png32/`echo $i | sed -e 's/svg$/png/'`; done
for i in *.[Ss][Vv][Gg]; do rsvg-convert $i -w 28 -h 28 -a -o ../png28/`echo $i | sed -e 's/svg$/png/'`; done
for i in *.[Ss][Vv][Gg]; do rsvg-convert $i -w 24 -h 24 -a -o ../png24/`echo $i | sed -e 's/svg$/png/'`; done
for i in *.[Ss][Vv][Gg]; do rsvg-convert $i -w 20 -h 20 -a -o ../png20/`echo $i | sed -e 's/svg$/png/'`; done
for i in *.[Ss][Vv][Gg]; do rsvg-convert $i -w 16 -h 16 -a -o ../png16/`echo $i | sed -e 's/svg$/png/'`; done
So I need to know where to store transfered images (one or more directories) and what names (or suffixes) give them to be able to load them via Image List Editor at once (if possible).
Thanks.
______________________________________________________________
Show quoted text 5 lines
On 23.05.2018 19:18, Vojtěch Čihák via Lazarus wrote:Thanks, I saw the demos, I see now how it works. But how can I add multiple resolution to ImageList? Is it possible only with suffixes and all images must be in the same directory? I need to push 10 resolution to one ImageList. Default res. is 16x16 and the others are 20, 24, 28, 32, 40, 48, 56, 64 and 80. How should I do it?
See the demo examples/imagelist_highdpi_runtime again.
Ondrej
----------
Vojtěch Čihák wrote 9 lines
I don't understand you. The design-time Image List Editor is a click-here/click-there WYSIWYG dialog. There are absolutely no rules how you have to save your images... Just load the images one-by-one. The resolutions will be detected automatically.
But I really advice you not to store all resolutions in the LFM. Instead, use one big resolution (typically 256x256). All needed resolutions will be automatically scaled from it in run-time. Add smaller resolutions only if they don't look good.
Ondrej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180523/078f6713/attachment.html>
Ondrej Pokorny wrote 12 lines
Oh, sorry, I missed the "at once". You can only load either several images in one resolution or one image list in multiple resolutions at once. For the former use "Add ...", for the latter use "Add more resolutions ..." (select all resolutions of the image in the open file dialog).
Ondre
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180523/14239c68/attachment.html>
I don't understand you. The design-time Image List Editor is a click-here/click-there…
______________________________________________________________
Show quoted text 5 lines
On 23.05.2018 19:35, Ondrej Pokorny via Lazarus wrote:On 23.05.2018 19:29, Vojtěch Čihák via Lazarus wrote:But I need to add images at design-time via Image List Editor. I have my images at *.svg format and I use script for converting (I use rsvg tool). So I need to know where to store transfered images (one or more directories) and what names (or suffixes) give them to be able to load them via Image List Editor at once (if possible).
I don't understand you.
Oh, sorry, I missed the "at once". You can only load either several images in one resolution or one image list in multiple the former use "Add ...", for the latter use "Add more resolutions ..." (select all resolutions of the image in the open file dialog).
Ondre
----------
I don't understand you. The design-time Image List Editor is a click-here/click-there…
@ Oh, sorry, I missed the "at once". You can only load either several images in one resolution or one image list in multiple the former use "Add ...", for the latter use "Add more resolutions ..." (select all resolutions of the image in the open file dialog).
It's clear now.
@ But I really advice you not to store all resolutions in the LFM. Instead, use one big resolution (typically 256x256). All needed resolutions will be automatically scaled from it in run-time. Add smaller resolutions only if they don't look good.
I would prefer to store all resolutions, rsvg creates very good images. If you mean problem with *.lfm size I guess that all images at 256 size will be bigger.
I will try.
Thanks.
PS: Previous message was accidentaly send empty. ______________________________________________________________
Show quoted text 5 lines
On 23.05.2018 19:35, Ondrej Pokorny via Lazarus wrote:On 23.05.2018 19:29, Vojtěch Čihák via Lazarus wrote:But I need to add images at design-time via Image List Editor. I have my images at *.svg format and I use script for converting (I use rsvg tool). So I need to know where to store transfered images (one or more directories) and what names (or suffixes) give them to be able to load them via Image List Editor at once (if possible).
I don't understand you.
Oh, sorry, I missed the "at once". You can only load either several images in one resolution or one image list in multiple the former use "Add ...", for the latter use "Add more resolutions ..." (select all resolutions of the image in the open file dialog).
Ondre
----------
I don't understand you. The design-time Image List Editor is a click-here/click-there…
I have one more question: do I understand well that ImageList stores basic resolution uncompressed in node Bitmap and all other resolutions compressed in node BitmapAdv?
Thanks,
Vojtěch.
______________________________________________________________
Show quoted text 5 lines
On 23.05.2018 19:35, Ondrej Pokorny via Lazarus wrote: Ondrej
----------
Vojtěch Čihák wrote 5 lines
Yes, this is due to forward compatibility with 1.8 and starting with Lazarus 1.11 the basic resolution will be compressed as well (because 1.10 will support compression of basic resolution).
Ondrej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180523/6a075855/attachment.html>
