[Lazarus] Component icons howto ?

Werner Pamler werner.pamler at freenet.de
Tue Mar 29 19:31:40 CEST 2022

Am 29.03.2022 um 18:37 schrieb Michael Van Canneyt:
> So you must always register the three images.

You are not forced to. But when you provide only the standard size and 
run the IDE at 200% the IDE will upscale the 24x24 image to double size, 
and the icon will become blurry - just as it was in the days before 
Ondrej implemented all these scaling functions. (BTW: a long time before 
Delphi which seems to support High-Dpi only now in the recent release).

>>>    As a corollary: what's with the strange names ?
>>>    Why not use the size of the icon in the name, that would be a lot 
>>> clearer IMHO?
>> That's the way it was decided. One advantage is that when images are 
>> needed for other purposes, but at different sizes (e.g. the icons in 
>> the message window which are much smaller) the scaling procedure can 
>> still be the same
> Not sure I follow the logic ?

I don't know the actual procedure names ATM, but imagine that when the 
message window needs a "warning" icon (which is - say - 12x12 at 96ppi) 
then the scaling procedure at 192ppi only needs to look for 
"warning_200.png". If the exact image size would have been included in 
the file name instead ("warning_24x24.png"), it would have to know the 
size of the base image at 96ppi in order to select the right image. A 
little simplification.

>>>    I looked in the WIKI but could not find any relevant info.
>> https://wiki.lazarus.freepascal.org/How_To_Write_Lazarus_Component#Step_3%3A_Create_icons_for_the_package 
> Hehe, the history shows you sneaked in the different sizes today. I 
> checked only last week, so I was pretty sure the info was outdated ;-)

I had written this part of the wiki already in 2018, so it definitely 
was not outdated. I just noticed that it was missing some basic 
requirements (like component name = image name) and decided to rewrite 
the paragraph.

> OK, I will look at the SVG files. It didn't occur to me I can remove the
> text. Or possibly simply change it to what I need.
I am attaching the three "database" png images extracted from the TDbf 
svgs without the text, in case you have problems with InkScape (which 
definitely will not win the prize of the most user-friendly software).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: database-icon.png
Type: image/png
Size: 876 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20220329/ab95210d/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: database-icon_150.png
Type: image/png
Size: 1595 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20220329/ab95210d/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: database-icon_200.png
Type: image/png
Size: 1464 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20220329/ab95210d/attachment-0002.png>

More information about the lazarus mailing list