[Lazarus] Component icons howto ?

Michael Van Canneyt michael at freepascal.org
Tue Mar 29 19:45:43 CEST 2022



On Tue, 29 Mar 2022, Werner Pamler wrote:

> 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).

OK, thank you.

>
>
>>>>    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 fail to see the link between 192 and 200. This requires people to know
that 96dpi and 144 dpi and 192 dpi are 100, 150 and 200 % of a standard size.

For me - and I've been in IT for quite some time now - this is far from
obvious that this should result in 24x24, 36x36 and 48x48 icon sizes.

In short: I think this is a horribly contorted scheme.

All other systems I came across simply use icon dimensions in the name. 
Far simpler and hence preferable in my opinion.

>>>>    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.

the 3 sizes were not mentioned when last I looked ?

>
>
>> 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).

Well, I managed to get something working with Inkscape. 
I already committed TJSONDataset. 
(for which, strangely enough, there was already an image)

Thank you for all explanations.

Michael.


More information about the lazarus mailing list