HVIF to BPicture drawing instructions?

I think I would be very bad trying to recreate a (very simple, mind you) HVIF icon by using drawing instructions for a BPicture. Is there anything that could help me with that.

Alterntively, possibly even preferred, is there a way to get a HVIF from a resource, but change the colours used by it. It seems I can only load it into a BBitmap, but at that point the colours are fixed…

I guess you could use libicon to parse the icon and modify it before rendering it.

1 Like

Using rc and/or xres it should be possible to extract your resource into a binary hvif file. Then you can drag and drop that into icon-o-matic for editing.

Misunderstanding. I already have a HVIF, created myself with IOM. It’s a simple one-colour icon that I want to use on a BButton. But I’d like to render it with the BButton label colour, i.e B_CONTROL_TEXT_COLOR.
Therefore I’d like to change the HVIF’s single used colour to B_CONTROL_TEXT_COLOR.

I’m exploring new territory for me here…
I think I don’t even need a BPictureButton using BPictures. I imagine I could just attach a BView to a BBitmap, draw stuff and use the BBitmap with my regular BButton with SetIcon(). Am I correct?

I may have to take a look at that if my BView drawing doesn’t succeed…

Ok, yes, in principle that can be done using a BPicture based on the icon drawing, but removing/editing the command that changes the color.

another option is to make two versions of the hvif with different colors, compare them in diskprobe to see what changes, and then you can patch the color at the right place in the icon before rendering it.

But if it’s only a single color, maybe it can be done with drawing modes, or with alpha masks, and that’s probably simpler. Basically, use your icon as a clipping mask (cliptopicture on a picture filled with a bbitmap rendering of the button, for example), and then fill the whole view with whateâer color you want. The color will be clipped to match the icon shape.

Thanks for yet another possible solution!
However, I managed to draw my very simple icon - really just two rectangles and a string - into a BView/BBitmap.

Do you think there were much pushback to proposing including NotoEmoji in a Haiku base install, which has many pictos etc. that could come in handy?

#17328 Preload Noto Emoji font

1 Like

Upvoted! Thanks for pointing out the issue!