[GtkAda] Gdk.RGB.Draw_Gray_Image?

From: Jacob Sparre Andersen (sparre_at_nbi.dk)
Date: 10/19/04


Date: 19 Oct 2004 15:08:22 +0200

I need to load a 2D array of integers (varying subset of 0 .. 65535)
into a Gtk.Image.Gtk_Image object.

It looks like the right approach is to:

 1) Map the original data into the type Gdk.RGB.RGB_Buffer.

 2) Use Gdk.RGB.Draw_Gray_Image to transfer this to a
    Gdk.Pixmap.Gdk_Pixmap object.

 3) Use Gtk.Image.Gtk_New or Gtk.Image.Set to transfer the
    Gdk.Pixmap.Gdk_Pixmap object to the Gtk.Image.Gtk_Image object.

My problem is the type Gdk.RGB.RGB_Buffer. It is declared as:

   type RGB_Buffer is array (Natural) of Glib.Guchar;

How do I avoid allocating such a large object, while still being able
to pass the correct data to Gdk.RGB.Draw_Gray_Image?

Is there a better option for loading a 2D array of integers into a
Gtk.Image.Gtk_Image object?

Thanks in advance,

Jacob

-- 
"Computer Science is to Science, as Plumbing is to Hydrodynamics"