Dr William Bland ([EMAIL PROTECTED]) wrote:
> Hi Simon,
>       Thanks!  That looks much nicer.  Unfortunately I can't get it to
> work properly (sorry, like I said, I'm a newbie at this ;-).  I now have
> the following code:
> static void
>     {
>       size = select_rgn.w * select_rgn.h;
>       select_data = select_rgn.data;
>       while (size--)
>       {
>         for (i=0; i<select_bytes; i++)
>           *select_data++ = 255*(size%2);
>       }
>     }
This is not correct. Please note that the data pointer still points
inside the complete tile. By simply accessing the pixel data linearily
you might leave the region indicated by the pixel region. To do this
properly you have to iterate over the rows separately (select_rgn.w *
select_rgn.bpp bytes) and then add select_rgn.rowstride to the adress
where line starts. Have a look at

there is a small graphics illustrating this. Sample code is also there.

I hope this helps.


      [EMAIL PROTECTED]       http://www.home.unix-ag.org/simon/
Gimp-developer mailing list

Reply via email to