Re: Problem returning ARRAYs in plugins

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

 



> Message: 1
> Date: Sat, 17 Nov 2007 23:59:29 +0100
> From: "Laurent G." <lauranger@xxxxxxx>
> Subject:  Problem returning ARRAYs in plugins
> To: gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
> Message-ID: <473F7251.6090600@xxxxxxx>
> Content-Type: text/plain; charset=ISO-8859-1
> 
> Hi,
> I have been fighting the evening long, trying to give data through such
> an array.
> I saw this post from this month on the archive and registered to ask the
>  writer of the advice if he could send us (or just me) an example of a
> working returning of array.
> I followed the "trick" of inserting an int32 before the array in args,
> but I keep getting my plugin to explode gimp on my calling to my simple
> procedure, at least while calling from python console. I can not figure
> out where I made the first mistake. So if I could compare my code with a
> working one, I could detect my error(s).
> Thanks in advance.
> 
> Laurent G.

Hi,

Here is some of the code that I use in order to return some int8 into an array.

gint w,h, ***fea_vector;

if (strcmp (name, PLUGIN_NAME) == 0){
        vector = (guint8 **) malloc(sizeof(guint8 *));
        if(get_some_pixels(image_ID,drawable,&w,&h,fea_vector)){/*put some vals*/
    *nreturn_vals=5;/*in fea_vector*/
    values[1].type= GIMP_PDB_INT32;
    values[1].data.d_int32= h;
    values[2].type= GIMP_PDB_INT32;
    values[2].data.d_int32= (gint32)w;
    values[3].type= GIMP_PDB_INT32;
    values[3].data.d_int32= (gint32) w * h;
    values[4].type= GIMP_PDB_INT8ARRAY;
    values[4].data.d_int8array = *fea_vector;

I don't use Python for writing plugins but I strongly recommend you doing some
debug. You can get to the code of "_gimp_wire_write" in libgimp/gimpprotocol.c
where the plugin surely crash while writing the values of the INT8ARRAY (at
least, it was here in my case).



-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/
_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux