pixmap transparency

20 views
Skip to first unread message

r...@amalasoft.com

unread,
Apr 12, 2019, 7:53:29 AM4/12/19
to Eiffel Users Group
Hi All
This is not a new topic, but I can't find a resolution, so here goes again.
I need to be able to create transparent pixmaps (i.e. pixmaps that have some areas that are transparent).
When working with EV_PIXMAPs , and applying an EV_BITMAP mask, the effect is only the mask or unmask the pixmap from being seen through the bitmap, not to make the pixmap itself transparent, so that is not the solution (despite header comments to the effect).

I have been able to create transparent cursors (pointer styles) using transparent pixmaps generated outside of Eiffel, then converted using eimgemb, so it certainly seems possible.  The conversion works just fine, by that evidence.  But, when I try to use a pixel buffer produced this way, and then convert it to a pixmap, it seems to lose its transparency, with the default bg taking its place.

While I'm asking for the moon, I might as well also ask if any of you knows of a way to do gradient transparency (e.g. from opaque to transparent in steps).  I assume once we can do any transparency, it would be a "simple" matter of looping through the pixels that count (or don't), but I'm open to other (easier) methods.

BTW, the bitmap-as-mask can be made to offer a kind of translucence (seemingly driven by relative luminescence), but again, only of the bitmap - not of the pixmap it's masking.
Thanks
R

Emmanuel Stapf

unread,
Apr 13, 2019, 1:30:31 AM4/13/19
to Eiffel Users
Hi Roger,

Are you using an EV_PIXMAP because you want to use it as a widget? In
this case, I suggest using an EV_DRAWING_AREA and draw the
EV_PIXEL_BUFFER object on it. There are some limitations with
EV_PIXMAP as it represents two completely different paradigm: an image
and a container with an image. Internally this causes an internal
promotion from widget to image and conversely. The promotion process
looses the transparency as it is based on a mask. When you use an
EV_DRAWING_AREA, you should be able to preserve the image
transparency.

Let us know how it goes!
Thanks,
Manu
> --
> You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-users...@googlegroups.com.
> Visit this group at https://groups.google.com/group/eiffel-users.
> For more options, visit https://groups.google.com/d/optout.



--
------------------------------------------------------------------------
Eiffel Software
805-685-1006
http://www.eiffel.com
Customer support: http://support.eiffel.com
User group: http://groups.eiffel.com/join
------------------------------------------------------------------------

Finnian Reilly

unread,
Apr 13, 2019, 6:21:16 AM4/13/19
to Eiffel Users
Hello Roger,
there are some caveats but Eiffel-Loop has a solution for what you are asking. Specifically you can use class EL_DRAWABLE_PIXEL_BUFFER which serves as a wrapper for the Cairo 2D graphics library, and is compatible with Vision2 16.05. There is also a class for rendering SVG EL_SVG_PIXMAP which also supports transparencies. The hard part was implementing it on Windows, requiring the distribution of GTK DLL's compiled with Mingw. These DLL's are not binary compatible with the latest Microsoft compiler, but they do work with SDK 7.1

I would send you a link to an application that showcases all this but at the moment myching.software is down and it will be a few days before I restore it.

As for gradient transparencies, the chances are that Cairo supports this and it would be relatively easy to add this to EL_DRAWABLE_PIXEL_BUFFER

regards
Finnian

Finnian Reilly

unread,
Apr 13, 2019, 6:45:37 AM4/13/19
to Eiffel Users
I forgot to mention Eiffel-Loop also has an Image Utilities library that does not depend on Vision2. This library has two classes for rendering SVG.
  1. EL_PNG_IMAGE_FILE (Recommended)
  2. EL_SVG_IMAGE_UTILS
Again the Windows implementation requires GTK dlls compiled with Mingw, downloadable from Eiffel-Loop.

r...@amalasoft.com

unread,
Apr 13, 2019, 7:04:07 AM4/13/19
to eiffel...@googlegroups.com
Hi Manu
Yes, I was hoping to use this as a widget (i.e. take the easy way out), but I can do the drawing approach.  I'll give that a try.
Thanks
R

r...@amalasoft.com

unread,
Apr 13, 2019, 7:10:32 AM4/13/19
to eiffel...@googlegroups.com
Hi Finnian
The mere mention of SVG gets me all-a-twitter.  Love them vectors, but (believe it or not) Windows is my platform of choice for such experiments, and I've moved to the more-or-less latest versions of stuff in that environment.  I will, however, take a good long (or is that longing?) look at what you've suggested.  It sounds very cool indeed (as we've grown to expect)
Thanks
R

-------- Original Message --------
Subject: [eiffel-users] Re: pixmap transparency
From: Finnian Reilly <frei...@gmail.com>
Date: Sat, April 13, 2019 6:45 am
To: Eiffel Users <eiffel...@googlegroups.com>

Reply all
Reply to author
Forward
0 new messages