[gtkada] Using Gdk.RGB.Draw_RGB_Image

Pedro Diaz Jimenez pdiaz88 at terra.es
Wed May 2 19:27:23 CEST 2001


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi All,

Thanks for the code snippets. I think that there are some things that are not 
correct. This code is known to work:

type My_Rgb is array (Natural range <>) of Gchar;
 function Conv is new Unchecked_conversion (My_Rgb,  RGB_Buffer );
A : My_Rgb (1 .. 256);
.
.
.
.
Draw_Rgb_Image (...., Rgb_Buf => Conv (A), ...);

Probably the problem is that Draw_RGB_Image expects an RGB_Buffer, not an
RGB_Buffer access

Thanks to all for the help

Pedro

P.S: By the way, It would be nice to have an example library with examples
using all the GtkAda packages. I'm willing to help.  Just tell what you think



On Wednesday 02 May 2001 11:54, Emmanuel Briot wrote:
> manuel.op.de.coul at eon-benelux.com writes:
>  > This array is constrained but indeed enormous. It looks like a problem
>  > with the Gdk.RGB package to me.
>  > It could be changed to make the Rgb_Buffer type unconstrained.
>
> The reason that RGB_Buffer is defined as above is probably because we used
> to have some functions returning this array. As you know, C doesn't provide
> information for the bounds, and thus we had to use what we call a "flat
> array" (don't know if this is standard terminology, or just internal to
> AdaCore), that is an array that doesn't have bounds information.
>
> However, such a type is only required if we have functions returning it. I
> just checked Gdb.RGB, and since we only use this type for parameters, there
> is no real need for it anymore.
>
> Indeed, the suggested changed by Manuel seems good, and we will incorporate
> them in some future release (not the next one, which is already packaged up
> and completely frozen).
>
> In the meanwhile, you can use some unchecked_conversion to use the package:
>
>
>  declare
>     type My_Rgb is array (Natural range <>) of Gchar;
>     type My_Rgb_Access is access all My_Rgb;
>     function Conv is new Unchecked_conversion
>          (My_Rgb_Access, RGB_Buffer_Access);
>
>     A : My_Rgb (1 .. 256);
>  begin
>     Draw_Rgb_Image (...., Rgb_Buf => Conv (A'Access), ...);
>  end;
>
>
> This should work, although I haven't tested it.
>
> Emmanuel
>
> _______________________________________________
> gtkada mailing list
> gtkada at gtkada.eu.org
> http://gtkada.eu.org/mailman/listinfo/gtkada

- -- 

/*
 * Pedro Diaz Jimenez
 * pdiaz88 at terra.es 
 * pdiaz at acm.asoc.fi.upm.es
 *
 * Wanna see how 100000! looks like?:
 * http://acm.asoc.fi.upm.es/~pdiaz/fact_100.000
 * 
 * La sabiduria me persigue, pero yo soy mas rapido
 */
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE68EN7nu53feEYxlERAiwbAJ0XucTxAOeS6OGlc1kAcbIb/ntlNgCg7gmn
vp/NQLN8TyYx9fOqkmXSWz8=
=pt6K
-----END PGP SIGNATURE-----




More information about the gtkada mailing list