[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: render fonts and get back the image by pixels



On Thu, Oct 28, 1999 at 10:55:33AM +0200, Berci Norbert wrote:
> 
> Hi !
> 
> I have already sent a letter to this list, but unfortunately I have not
> received any replies to it. :( I thought this list is a forum of non trivial
> questions and the people who knows the answer. If my question is RTFM, or
> so beginner, tell me. But getting no answer is a very bad thing.
> 
> So please tell me which widget and which function(s) I have to use for
> the following:
> 
> 1. I want to draw on the widget both colour pixels and colour primitives
>    (lines, circles, etc.) by the gdk_draw_ series of functions.
> 
> 2. I want render colour fonts on it (e.g. display text on it)
> 
> 3. I want it displayed in the application's window, of course ;)
> 
> 4. I want to get the whole image by RGB values (or by colormap indexes,
>    but in this case I want to know the colormap index => RGB mappings,
>    obviously) so I can save it in a file for post processing.

You may you use GtkDrawingArea, get a GdkDrawable from the drawing
area and use the gdk_draw_ functions. Something like
...
GtkWidget *drwArea;
GtkDrawable *drwBle;
...
drwBle = drwArea->window;
...
gdk_draw_rectangle (	drwBle, 	
		   	drwArea->style->white_gc,
	     		TRUE,
			0, 0,
			drwArea->allocation.width,
			drwArea->allocation.height	);

gdk_draw_string ( 	drwBle, 	
			font,
			gc,
			bla...bla.....

You got to connect it to the events configure_event, when the widget is
created or resized, and expose_event, that is when a windows is moved off
of it or gets repainted.

Hope it helps
-- 
Francisco Oltra Thennet
Departamento de Ingenieria Electrica
Universidad Catolica de Chile
(56)(2) 686-5968
(56)(2) 552-2563 (fax)
e-mail: foltra@puc.cl, foltra@latinmail.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]