Re: How to add a badge to an icon?
Jean Truc <[email protected]> Sat, 4 Jan 2025 12:51:56 +0100
| Newsgroups | gmane.comp.lib.fox-toolkit.user |
|---|---|
| Message-ID | <[email protected]> |
Thanks a lot for your answers. You pointed me in the right direction!
So, I ended up with the following very simple solution. In functions
that draw the icons, I added a line to draw the badge, like this :
dc.drawIcon(bigIcon, xi, yi);
if (bigIconBadge != NULL)
{
dc.drawIcon(bigIconBadge, xi, yi);
}
The badge icon (which has transparency) is then correctly displayed
above the file icon.
Le 03/01/2025 à 15:26, [email protected] a écrit :
> On 2025-01-03 07:38, Roland Hughes via Foxgui-users wrote:
>> Traditionally you use a graphics tool, create 2 different icons, then
>> use the appropriate icon. This is irregardless (never should have
>> banned that word!) of the graphics library you are using.
>>
>> The left-handed-you-must-have-been-drunk-on-a-Tuesday method is create
>> two icons of the exact same size and place them in the exact same
>> position. One icon will be at least 50% transparent so when placed on
>> top you can still see some of the other below.
>
> Since FXIcon is derived from FXImage, you can make it the destination
> of drawing operations [after create() generates its off-screen X11-server
> resident buffer].
>
> So, make a mini-image of your badge, then draw it onto the base icon,
> then draw the icon to the screen repeatedly.
>
> The difference between FXIcon and FXImage is, however, that the FXIcon
> also has two additional 1-bit buffers for the mask and "etch" mask.
>
> You may need to find some way to update those as well [I have no
> super-easy solution for it, maybe restore() local buffer from updated
> server-side buffer, and regenerating the masks, is the best idea for
> now.
>
>
> -- JVZ
_______________________________________________
Foxgui-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/foxgui-users