< Back to IRCAM Forum

Vector Graphics as Icons in OpenMusic

Hi,

I’d like to add the capability of using SVGs as icons in OpenMusic. Is it possible without changing OpenMusic’s codebase in any major way? If not, what do I need to do in order to make it happen? I’m perfectly willing to put in the months and hours of learning and development in order to make it happen on my own time, even if it requires me purchasing a LispWorks license.

All the best,
António

Hi António.

On my machine:

(gp::list-known-image-formats nil) → (:XPM :XBM :WEBP :TGA :SVG :QTIF :PNM :JXL :ICNS :GIF :AVIF :ANI :WMF :CUR :ICO :JPG :TIFF :JPEG :PNG :BMP)

indicating it should be quite straight-forward?

Not sure how much or where you’d have to adapt in OMs code, you’ll
probably find what you need inside code/kernel/graphics/

Possibly not too much adaption? OM’s code is usually quite generic…

1 Like

Hi Anders,

Yeah, I imagine it will take some time and attention to detail in order to not bust anything but the codebase won’t change much in the process. Highly repetitive chore but the end result is worthwhile in my view.

All the best,
António

Dear Antonio,

Just curious, may i inquire why you need to use svg for icons?

Best
K

Hi Karim,

It’s purely aesthetic, it would allow me to customize OpenMusic’s visual setup and presentation. Vector graphics seem perfect for visual programming environments like OM.

All the best,
António

Thanx Antonio,

As Anders states this will require some hacking, maybe in the api/om-LW/icons-picts.lisp code. So somehow low level.
Tell me if you need some help.
(meanwhile i will try evaluate the difficulty of this).

Best
K

1 Like

Hi,

I’ve skimmed through kernel's iconview.lisp and api's icons-picts.lisp and I haven’t seen anything that should stop vectors from being imported or loaded, I fail to see what’s missing. I’ve added "svg" to the cursor and pict type file extensions without any issues but that’s it. I’ll need to upgrade my chops in LISP, it should be fun.

All the best,
António

Dear Antonio,

It is not a Lisp issue but rather a LispWorks Capi issue. I will take a look and come back to you.

Best
K

1 Like

Dear Antonio,

In order to use svg icons just put this patch in the init folder of your OM installation:
iconpatch.lisp (93 Bytes)

And restart OM.

Best
K

Hi Karim,

Much like what happened when I added “svg” to iconview and icons-picts yesterday, unfortunately it doesn’t work on my end either. I only get an empty viewbox as well.

All the best,
António

Dear Antonio,

Can you send me an example, maybe your svg file?
I tried this patch with a stable OM version and i get an svg icon…

Hi,

Of course. I’ve attached a function and its icon. You can place the function in the init folder and the SVG in the usual icon folder.
add.lisp (633 Bytes)
1001

All the best,
António

PS: The SVG file should be named 1001.svg. Sorry about that, I didn’t know we could embed SVGs here.

Dear Antonio,

For me it worked on Linux:
Screenshot_2024-06-15_00-24-24

By the way, Beautiful Icon…!
On what platform you are testing ?

Best
K

Hi Karim,

I’ve tried it in OM 7.0 and 7.4 in an Apple Silicon mac and Intel mac running macOS Sonoma and Ventura. In both cases I get an empty viewbox, as if it was imported but not rendered. Could it be an issue of permissions? I don’t see any other reason why it would work on Linux but not Mac.

All the best,
António

Dear Antonio,

Will look into that. It could be that OM being placed in /Applications folder there is some permissions issues due to Apple protection. Will test it on my Mac and report back.

Best
K

Hi Antonio,

Apparently on Mac there is something missing to make it work (a method or something like that). I beleive it is an LW related issue. Will check it and come back to you.

Best
K

1 Like

Hi Karim,

Have you figured out what’s missing? I carefully looked into iconview and icons-picts and I still can’t figure it out.

All the best,
António

Dear Antonio,

It is a LW/Mac issue. I am afraid that svg is not supported as Icon. But still should check it up with LW. For the time being i am on vacation and don’t have a Mac around. So it will have to wait a bit.
Sorry

Best
K

Hi,

Oh, sorry for bothering in your off time. And thank you for looking into this.
Enjoy your vacation.

All the best,
António

Will let you know as soon as i have a mac. no worry.

Best
K

1 Like