[Lazarus] Component icons howto ?

Ondrej Pokorny lazarus at kluug.net
Wed Mar 30 16:52:16 CEST 2022


On 30.03.2022 10:44, Michael Van Canneyt via lazarus wrote:
> On Wed, 30 Mar 2022, Arne Hanssen via lazarus wrote:
>> Den 30.03.2022 09:57, skreiv Michael Van Canneyt via lazarus:
>>>
>>> [...]
>>>
>>> Why do you think I know this is a scaling factor ?
>>>
>>> I didn't have a clue until Werner explained.
>>>
>>> Sorry, you can argue all you like, but if I see a list of icon files 
>>> xyz_24x24.png then I know *exactly* what to create, just from the 
>>> filenames. No need to do math, open file whatnot.
>>>
>>> With your method, I need to open the file (unless I know standard 
>>> size is
>>> 24), check the size, and then possibly multiply (if I know that the 
>>> suffix
>>> is the scaling factor in %).
>>>
>>> [...]
>>>
>> I would guess that naming the files 'xyz_24x24.png' (base size 24px), 
>> 'xyz_24x24_150.png' (150% 36px) and 'xyz_24x24_200.png' (200% 48px) 
>> could be a reasonable naming solution?
>
> As I said: 150, 200 do not strike me as scalings in percent.
>
> That the CPU needs to do an extra couple of cycles (convert scaling to
> pixel) to make things easier on humans - that's why mankind invented it.
>
> Forgive me, but I will discontinue the discussion.
>
> I think I made it clear what I think is (in my view) absurd and have 
> no wish
> to antagonize anyone by continuing to argue for something which should be
> obvious and plain.

I don't think anybody took this personal - definitely not myself. But I 
still don't know what you intended with the discussion. The naming 
convention has been like this for 5 years - I introduced it in this 
commit 
https://gitlab.com/freepascal.org/lazarus/lazarus/-/commit/2135d3058f078e3df8b957c4fa4e52e1fa1ae83b

We now tried to explain the reasoning behind it - I honestly did not 
care that much about the naming convention back then: I just took what 
was the simplest way from my POV - simplest to extend the existing code 
and the existing directory and file structure. I concentrated much more 
on the scaling system behind it as it was quite a monster of a change. I 
do admit that I did not think about the icon creators on the other side 
at all - so I missed what you see is "obvious and plain". Sorry for that 
but what should I do with it now?

If somebody (including you) had raised the discussion about the (not 
obvious) naming back then before hundreds of icons were added, it would 
have been a much easier change than today. But there was no such 
discussion (no alternative was either suggested or rejected), so we 
ended up with the solution that I picked up. There were no bad 
intentions from my side, I just decided somehow and nobody has 
complained about it for 5 years. That's all about it.

I now cannot do a lot about a 5-year-old decision. Yes, it may have been 
wrong, but I am not going to rename all the files added in the meantime 
by myself...

Yes, we can still extend the code to support Delphi's naming convention. 
But as Werner stated before, we won't rename current icons ourselves. If 
you want to take the effort because you think it is worth it and Werner 
is not against, go for it. I personally don't think it is worth it.

In the end it's just about file names, the result is the same: the user 
sees pixel-perfect icons and the IDE scales nicely. A different naming 
convention won't improve that.

Ondrej



More information about the lazarus mailing list