Haiku icon is the best format

Okay, in that case it would seem that they should share some rendering code at the least. This suggests that there should be a C++ superclass for vector rendering and editing.

Why?
You can translate stuff to BPicture and use that. HVIF currently can use a single pass rendering, if you adapt the code to do severall formats you will likely loose that. Why change this code? It works fine for it’s usecase.

2 Likes

A superclass is not the right tool for that. But you can already share the rendering code, in two possible ways:

  • Use BView drawing APIs, that’s what they are for
  • If that is not flexible enough or not fast enough, you can use AGG directly. That’s the backend used by app_server for all rendering in Haiku and it is also used by libicon

But I suspect the other libraries will rather use Cairo if they are developed on other platforms, since that is a lot more popular than AGG these days.

1 Like

The HVIF format actually already allows a coordinate to be specified in 7 bits or in 15 bits. The 15 bit number allows more precision and more range than the 7 bit format. Floating point numbers, such as those used in the affine transformation, however, are always 24 bits.

1 Like

15 bits are good for most purposes outside of icons. I doubt the 32-bit size will ever see much use in TinyVG.

1 Like

Good day,

I finally decided to do this test:

And this in Windows:

This folder is a simple folder, only three shapes with solid flat colors, no gradients, no renaissance stuff. Simple and plain.

So what we see from here is:
1- IOM format icon is bigger (3.19K) than same thing made in Inkscape (2K)
2- Exporting from IOM to SVG renders a very small file already (424bytes), compared to regular Inkscape SVG (2K)
3- Exporting from IOM to HVIF renders a tiny file (62bytes)
4- Exporting from IOM to HVIF Rdef is tiny though not as tiny (188bytes) as HVIF
5- In this case Inkscape optimized SVG takes same space as regular Inkscape SVG (2K in both cases), though I’ve noticed big difference in Linux

In fact, the ratio between IOM file (just ‘Folder’) and Folder.svg is similar to the ratio I get in Linux when saving as regular Inkscape SVG compared to Optimized SVG.

So yes. HVIF is a great format for icon definition files. Now, I would just like it to be easier to set an icon theme on Haiku :wink:

Regards,
RR

3 Likes

I made an icon that looks the similar to yours and exported it to a TinyVG. It was 84 bytes. Therefore, HVIF comes out ahead by 22 bytes! I couldn’t test IconVG since there doesn’t appear to be any SVG to IconVG converter around.

3 Likes

For anyone wondering: exporting to .rdef (a text-only file format) is meant to be used as input of the “rc” command, to convert/add those “resources” to binaries (icons, flags, supported file types, version info, etc. etc.), and not intended to be an image format (even less so an efficient one at that :smiley:).

4 Likes

If the cluster size on your Windows box is 2k, your SVG file will not get smaller.

2 Likes

Good day @SamuraiCrow,

Yes you are right. The funny thing is that the 'optimized’takes actually more space than the regular SVG in windows by a slight margin. This does not happen in Linux., where the ‘optimized’ takes less space, noticeably.

Windows:

Linux:

Of course, I’m using the same optimization settings in both OSes.

Regards,
RR

But did you create the file again in both OSes, or copied the file from one to the other ?

Different versions / libraries could account for the difference in size

Good day @RogFanther,

To make the process as clean, neutral, and objective as possible, I made the file from scratch on each OS. Only three shapes with flat fills, yellow, white and brownish, same sizes, 64x64 pixels frame, and with same space around the icon in said 64x64 frame.

In IOM, the frame is already 64x64. In Inkscape (Win & Lin) I set the page size to 64x64, 4px grid, matching IOM’s.

Now, thinking aloud, this might have something to do with an issue I had noticed the first time I started to use IOM. Bringing SVG files from Inkscape (without optimization) into IOM rendered weird visual results, and the icon in IOM not matching the icon created in Inkscape. I didn’t know back then what I know now though.

Should test that again now… :thinking:

Regards,
RR

2 Likes