[GSoC 2023] Improving Icon-O-Matic Final Report

Blog post by Zardshard on Fri, 2023-08-18 11:21

What is Icon-O-Matic?

Screenshot of Icon-O-Matic

There’s a good chance that not everyone reading this article will know what Icon-O-Matic is, so I’ll start by explaining what it is. Icon-O-Matic is a vector graphics editing program like Illustrator or Inkscape. It is specifically made to work with Haiku’s custom HVIF vector graphics format. This format is similar to the SVG format, except optimized to be much, much smaller. The blog post “500 Byte Images: The Haiku Vector Icon Format” provides a more in-depth discussion for those interested.

If you want to try Icon-O-Matic yourself, you will need to first install the Haiku operating system. Afterwards, you can launch it from the applications menu.

My goals

The goals of my project were rather broad: to add features, refactor code, and fix bugs. I had, therefore, a lot of leeway to do what interested me. My early plans were detailed in a blog post entitled "[GSoC 2023] Plans for improving Icon-O-Matic". They changed rather significantly over the course of the project.

What I got done

Below is a list of the things I got done during GSOC. For those interested in seeing the full list, it can be seen here. This list does not include commits made outside of GSOC.

Fixed memory leaks

For those not familiar with it, a memory leak occurs when a program requests memory from the operating system and later forgets to tell the operating system that it’s done with it. This leads to memory being wasted. In the worse-case scenario, the program eventually uses up all of the system’s memory.

One of my GSoC project ideas was to make a program to detect memory leaks. I had decided not to go with that. Later, I discovered that Haiku had a memory leak detector built-in! I wrote a blog post detailing how to use it so that others knew of its existence and how to use it. I was excited to use this memory leak detector on Icon-O-Matic, so, that was one of the first things I did.

And, indeed, I did find and fix many memory leaks. Some of these leaks were caused by system libraries. This means that some of the bugfixes helped every application leak less memory.


Added reference images

Screenshot of three reference images

This is probably the most useful feature that I added. This allows you to create an image in another program such as Inkscape or Illustrator and then use Icon-O-Matic to trace it. This is useful since Icon-O-Matic is required to make HVIF files but doesn’t have as many features as many other programs. This also gives Icon-O-Matic greater ability to specialize in making small HVIF files as opposed to being a general-purpose vector graphics program.


Added perspective transformations

Screenshot of a grid being put into perspective

I believe this feature will be a lot less useful than reference images. Ironically, it also took quite a bit more time to implement than reference images. Implementing this feature also took the most math. I used quite a bit of linear algebra to figure out how to determine whether a perspective transformation was valid or not!


Reduced repeated code

This shaved off 1,300 lines of code from Icon-O-Matic. This one is the only change that caused a regression, at least, as far as I’m aware ;)


Miscellaneous improvements

There are various miscellaneous improvements that I made to Icon-O-Matic along the way. Some are bugfixes. Others introduce some simple features. None of these took very much work.


A full list can be seen here.


It’s surprising how long some of these things took to do. My original project proposal for GSoC included time estimates. Unsurprisingly, my plans changed over the course of GSoC. By the end of GSoC, I had only done one of the things I had originally planned to do: adding reference images. I had estimated that adding them would take 1 week. I was aware that things tended to take longer than estimated so I made room in my estimates for that. Despite that, adding reference images actually took, depending on how you count, 2-3 weeks!

I also learned about the importance of communities surrounding open-source projects. These communities influence what happens on the project, give developers ideas and feedback, and find bugs. The developers can help other developers, give them tips, or, just as importantly, criticize their ideas. These communities are also a nice place for people to simply hang out and socialize.

Thanks to Google for hosting Google Summer of Code. Without you, I would not be here. Thanks also to my mentors, PulkoMandy and Humdinger, and to the broader community surrounding Haiku. You have given me advice, pointed out pitfalls, and given me many ideas.