LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-11-2008, 09:48 AM   #1
PatrickNew
Senior Member
 
Registered: Jan 2006
Location: Charleston, SC, USA
Distribution: Debian, Gentoo, Ubuntu, RHEL
Posts: 1,148
Blog Entries: 1

Rep: Reputation: 48
gdk bitmap drawing?


Okay, so I'm trying to implement a rounded window in Gtk (gtkmm specifically). The standing answer on the web seems to be that Gtk themes should be used for this task, but it doesn't really fit this task, as I need both rounded and non-rounded windows in the same UI. Additionally, I would like the corners rounded more than I've seen any theme do. (This is for a Screenlet/Applet/Widget thingy.)

Now, my current attempt at an implementation is to pack a table into the window, put drawing areas in the border, and put whatever would have gone in the window into the center of the table. The rounded effect is then created via shaped windows (via gdk_window_shape_combine_mask).

My biggest trouble right now is that I can't seem to draw on the Gdk::Bitmap which would be my shape mask. Previously, I've always gotten these Bitmaps from gdk_pixmap_render_alpha_threshold, but there isn't a pixmap backing the window, and since the window can change size, I need to be able to draw on the Gdk::Bitmap to get the desired effect.

I create the Bitmap with gdk_bitmap_create_from_data, then get it's GC and try to draw on it with that GC and standard GdkDrawable functions (gdk_drawable_draw_arc and gdk_drawable_draw_rectangle). When I do this though, the window I get out is always absent. That is, the window manager decorations appear, but it seems the mask was set to all pixels off.

I suspect that the problem is that my GC's foreground is set to the value which indicates transparent (I assume 0, but maybe 1). Trouble is, I don't see any way to change the foreground color without using a GdkColor, which can't be used until it is allocated, which can only be allocated if my Bitmap has a colormap, which it seems that Bitmaps never do.

So, has anyone here ever had to draw on a Bitmap before? How did you get it done?
 
  


Reply



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
Copy bitmap into framebuffer bertramgeck Linux - Software 0 03-19-2007 08:15 AM
convertion of 24 bit bitmap image to 8 bit bitmap image vipulc Linux - General 2 03-10-2006 08:22 AM
bitmap indexes in c++ crapodino Programming 2 11-27-2005 07:43 PM
Displaying Bitmap hylke Programming 14 09-02-2004 01:59 PM
creating a bitmap qanopus Programming 1 12-04-2002 05:57 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:39 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
Open Source Consulting | Domain Registration