Re: alpha for text?
- From: John Cupitt <jcupitt gmail com>
- To: Paul Pogonyshev <pogonyshev gmx net>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: alpha for text?
- Date: Sat, 16 Jul 2005 01:06:15 +0100
On 7/16/05, Paul Pogonyshev <pogonyshev gmx net> wrote:
John Cupitt wrote:
On 7/15/05, Paul Pogonyshev <pogonyshev gmx net> wrote:
Has anyone rendered text with alpha channel (i.e. semitransparent text)
in GDK framework? So far my best solution is to render black on white
to a GdkImage, get it back in a GdkPixbuf and then add color/transparency
manually. Not actually too difficult, but I want to ask in case somebody
can come up with something better.
You can use pangoft2 to render text on the client side and thereby
avoid shipping images back from the server. Not much neater, but quite
a bit quicker.
Can I have a little more information here, please? I thought GtkImage was
client side. And if not, is your approach portable all the way back to
I hope I'm not misunderstanding you here (apologies if I am), but I
think it sounds like you are rendering text to an off-screen pixmap
with gdk_draw_layout(), fetching to the client as a GdkImage, then
going to a gdkpixbuf to manipulate it. The gdk_draw_layout() is
probably rasterising the font with freetype2 client-side, then
shipping the rendered glyphs to the server. So you may well be sending
the data both ways.
If you've not seen it, have a look at pangoft2topgm.c in the pango
sources. It's a command-line program which renders text directly to a
bitmap (with no X server) using pangoft2. I used this as a base for a
text render operation in my image processing library with great
success. As far as I know, this will work on any gtk+-2.0, though I've
not tested it.
] [Thread Prev