[gtk-server] Re: draw string on pixmap gc

  • From: Peter van Eerten <administrator@xxxxxxxxxxxxxx>
  • To: gtk-server@xxxxxxxxxxxxx
  • Date: Fri, 08 Sep 2006 17:35:41 +0200

Hi Eduardo,

At the GTK-server website you can find two examples on how to do it.

These are:

http://www.gtk-server.org/canvas.lsp
http://www.gtk-server.org/fractal.lsp


(Indeed these examples cannot be found at my newLisp website.) The last example
is most easy to read, I think.

Anyway, in these programs you can see how it works. In short, the code looks
like this:

# Put some text on the canvas
(set 'LAYOUT (gtk_widget_create_pango_layout IMAGE {"Some text"}))
(gdk_draw_layout PIX GC 130 240 LAYOUT)


The variable 'IMAGE' points to a gtk_image, the variable 'PIX' to a gdk_pixmap,
and the variable 'GC' points to a gdk_gc.

Please refer to the Pango documentation for details on font size, type, and so
on. Of course additional Pango-functions must be added to the GTK-server
configfile first, before they can be used.

Hope this helps.

Regards
Peter


Citeren Eduardo Costa <edu500ac@xxxxxxxxx>:

> Hi, Peter
>
> A user of the gtk-server bindings for Bigloo (Dr. Reny Cury) pointed out that
> there is no means of writing text on the graphic canvas (pixmap). In fact, I
> did not implement this feature (draw strings), and do not know how to do it.
> I guess that it has something to do with the function gdk_draw_drawable, but
> I have no idea of how to use it, and could not find a model in your examples
> for newlisp.
>
> Eduardo Costa
>


-- 
http://www.gtk-server.org

Other related posts: