Hi
Anybody with an idea on how to get the mask for blitting an svg icon? It's supposed to be antialiased, so the mask can't be 1-bit like in the automask function. I'm using Image.from_icon to load the icon, but the Image object doesn't seem to provide the masks of transparent objects (be it icons, png files...).
EDIT: Here's what I came up with myself: load the icon to a big bitmap (a few times bigger than the size at which it will be used), convert it to a 1-bit image, scale it down (with antialiasing) to the target icon size, and save as an 8-bit mask. Then scale the original icon to the target size and blit to the canvas using that mask.
The only problem now (with the theory) is that the pixels on the edge of the icon will be shifted towards white (as they get melted to the white background when scaled). I'm gonna try that tommorow to see if it's viewable (or maybe even has some interesting glowing effect).

Reply With Quote

