LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-15-2010, 05:43 PM   #1
cascais
LQ Newbie
 
Registered: Oct 2010
Location: Lisbon Portugal
Distribution: ubuntu 10.04,debian lenny
Posts: 1

Rep: Reputation: 0
cairo_set_source_rgba() and gdk_color_parse() Fail in debian lenny


cairo_set_source_rgba() and gdk_color_parse() work ok in ubuntu 10.04 (gtk2.20...). Fail and crash in debian lenny (gtk2.12....) althougth compiling ok.
Some of my code:
...
gdk_color_parse("white",color);
...
Set_transparent(window);
...

static gboolean on_window_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
cairo_t *cr;
cr = gdk_cairo_create(widget->window); // create cairo context
if(alpha_channel_support) // set source to RGB-Alpha
cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 0.0);
else
cairo_set_source_rgb(cr, 1.0, 1.0, 1.0); // set color RGB
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); // set drawing compositing operator
// SOURCE -> replace destination
cairo_paint(cr); // paint source
cairo_destroy(cr);
return FALSE;
}

void Set_transparent(GtkWidget *w)
{
GdkScreen *screen;
GdkColormap *colormap;

gtk_window_set_keep_above(GTK_WINDOW(w),TRUE);
gtk_window_set_decorated(GTK_WINDOW(w),FALSE);
g_signal_connect(G_OBJECT(w), "expose-event", G_CALLBACK(on_window_expose_event), NULL);
gtk_widget_set_app_paintable(w, TRUE); // allow application to paint on widget
screen = gtk_widget_get_screen(w);
colormap = gdk_screen_get_rgba_colormap(screen); // get colormap with alpha channel
if(colormap != NULL)
alpha_channel_support = TRUE;
else
{
alpha_channel_support = FALSE;
colormap = gdk_screen_get_rgb_colormap(screen);
g_message("Screen supports no alpha channels\n");
}
gtk_widget_set_colormap(w, colormap);
}

How showld it be in debia to work?
Thanks all
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
xen fail to start Debian Lenny xen-3.2.1 tkmsr Linux - Virtualization and Cloud 1 05-10-2010 12:27 PM
Debian Lenny - SAN - LVM fail Vorik Linux - Server 2 11-30-2009 01:42 PM
does Debian Lenny/sid support Debian Sarge Binary Installer..? @nthoon Debian 1 06-14-2009 11:47 AM
LXer: How To Upgrade A Debian Etch System (Server & Desktop) To Debian Lenny LXer Syndicated Linux News 0 02-20-2009 05:30 PM


All times are GMT -5. The time now is 05:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration