Re: gdk_pixbuf_composite_color() help needed.
- From: Tim Evans <t evans aranz com>
- To: gtk-app-devel-list gnome org
- Subject: Re: gdk_pixbuf_composite_color() help needed.
- Date: Mon, 25 Aug 2003 14:27:41 +1200
Dave Andruczyk wrote:
I'm trying to overlay my application's logo over an empty space in my gtk+2
prog (MegaTunix). In this mostly empty window exists a label and a
drawingarea, bothed packed into a vbox. I've successfully setup the
expose/configure events modeling after the "testpixbuf" demo from the gtk+
source code. For the most part it works, EXCEPT I want to be able to display
the logo and have it blend in smoothly with the window no matter what color the
window may be (User may have a theme with different BG colors than mine, or a
pixmap background)
The only way I found thus far, was to retrieve the style of the parent widget
(the vbox in this case) and extract the bgcolor from it, the problem is it's a
GdkColor which stores the colors in 16 bit formats. The
gdk_pixbuf_composite_color() accepts two colors with 8 bits per component only
(I use the same color for each to avoid a checkerpattern) but in RGB packed
format (only 8 bits per R, G or B component). In my conversion from 16 to 8, I
loose resolution and the composition ends up having a rectangular box (the size
of the drawingarea) that is close, but not exactly the same color as the rest
of the applications background color. It works (with the slight color
mismatch) with theme changes as long as the theme doesn't use a pixmap
background (instead ofa solid color).
I want to be able to display my logo (which has an alpha channel) on one of my
app's panes (gtk_notebook used) and have it blend into the background properly
no matter if the user is running a pixmap style theme or an arbritrary color
schemed theme.. (it almost works for the latter, I have no idea how to do the
former..)
Anyone got any ideas? I'm currently stuck at this point.
Why not just create a GtkImage widget and use that to display your
pixbuf? GtkImage is a subclass of GtkMisc, just like GtkLabel, so it's
basically a label that displays an image instead of some text. Use
gtk_image_new_from_pixbuf to easily create the widget and set it to
display your pixbuf.
--
Tim Evans
Applied Research Associates NZ
http://www.aranz.com/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]