Re: Newbie Q: What to use ...
- From: Jan-Marek Glogowski <glogow fbihome de>
- To: Soren Kuula <dongfang bitplanet net>
- Cc: gtk-list gnome org
- Subject: Re: Newbie Q: What to use ...
- Date: Sun, 4 Jul 2004 04:33:33 +0200 (CEST)
Hi
>From my first impression I think you can simply use a GtkDrawingArea and
GdkPixmap(s).
Look at GDK Docs -> Drawing Primitives, if you want to move from X to GDK.
> 1) Stick with Xlib primitives for displaying ants ? OK, but I can't see
> which kind of widget that will allow
> me to use XLib drawing primitives on it, or how to somehow extract
> an XWindow from a widget
GDK Docs -> X Window System Interaction
GDK_DRAWABLE_XID( any GdkDrawable )
e.g. GTK_WIDGET( my_gtk_drawing_area )->window
I think this would be the fastest, if you want to stick with your current
X functions.
> 2) Use Gnome canvas ? Might be fine for the debugger, but isn't it much
> slower than XLib for the main
> battlefield view ?
It should be fast enought, but I have no experience.
BTW: GnomeCanvas doesn't depend on Gnome - people tend to miss that.
As long as you don't have [moving] objects (like sprites), you want to
handle like GtkObjects (signals, ...), GnomeCanvas may be overkill.
> 3) Use GDK primitives ? But I need to be able to control the color of
> the ants directly. Can I somehow
> set the drawing foreground color in RGB directly ? Seems to me that
> GDK was made for drawing
> widgets, not much more.
Any drawing is done using GDK Graphics Contexts (GdkGC)
gdk_gc_set_foreground( GdkGC, GdkColor ), with
struct GdkColor {
guint32 pixel;
guint16 red;
guint16 green;
guint16 blue;
};
Simply create some GC with you required colors after widget realization,
if you just need some, and free them at unrealization.
> 4) Use GDKRGB ? I can see how to use that for displaying a static image
> :) But I also need to be able
> to manipulate individual pixels, or rectangles in the image
> dynamically, and preferably fast :)
No - you have a dynamic picture (GDK docs): "GdkRGB is a low-level module
which renders RGB, grayscale, and indexed colormap images to a
GdkDrawable."
How do you want to handle window resize?
Do you want to support scrolling a larger image?
HTH
Jan-Marek
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]