GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Wed Apr 23, 2014 9:03 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Drawing in GTK+
PostPosted: Mon Oct 31, 2011 11:19 am 
Offline
Familiar Face

Joined: Mon Oct 31, 2011 11:10 am
Posts: 8
Hi,
i've googled a bit and tested some cairo code...since this are vector-graphics and the graphics are antialiased (graphics are diffused) i don't want to use them.

there are some drawing routines like here http://www.gtk.org/tutorial1.2/gtk_tut-23.html.
these are using a offscreen-pixmap, so i want to use this, if thís is supported in further future (tutorial is for gtk+1.2).

my application schould export to bitmap/pixmap and print.

later i want to draw animations, so i want to use an offscreen-bitmap for reducing flicker

i'm currently experimenting with the normal drawing routines and have some problems with the colors...

Code:
  pixmap = gdk_pixmap_new(widget->window,
                          widget->allocation.width,
                          widget->allocation.height,
                          24);
  GdkGC *gc=gdk_gc_new(pixmap);
  GdkColor color;
  gdk_color_parse ("blue", &color);
  gdk_gc_set_foreground(gc, &color);

  gdk_draw_arc (pixmap,
                      gc,
                      TRUE,
                      0, 0,
                      widget->allocation.width,
                      widget->allocation.height,
                      0,64*360);

color-problem fixed...
as the documentation says http://developer.gnome.org/gdk/stable/g ... foreground, i have to use gdk_gc_set_rgb_fg_color()

can i use the "old functions" or should i use cairo, but how to make clear images on a offscreen-bitmap

regards Frank


Top
 Profile  
 
 Post subject: Re: Drawing in GTK+
PostPosted: Mon Oct 31, 2011 8:52 pm 
Offline
Never Seen the Sunlight

Joined: Wed Jul 23, 2008 10:31 am
Posts: 2406
Location: Slovenia
Hello and welcome to the GTK+ forums.

You should definitely use cairo, since everything else has been phased-out of GTK+ in latest incarnation (3.0 and newer). To disable antialiasing, simply call cairo_set_antialias() function with value of CAIRO_ANTIALIAS_NONE and rasterizer should do what you need.

Cheers,
Tadej


Top
 Profile  
 
 Post subject: Re: Drawing in GTK+
PostPosted: Thu Nov 17, 2011 4:33 pm 
Offline
Familiar Face

Joined: Mon Oct 31, 2011 11:10 am
Posts: 8
How do i realize offscreen Bitmap with cairo?

can i use the gdk-cairo-routines:
http://developer.gnome.org/gdk/stable/g ... ction.html
?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group