Re: [Gimp-developer] Double tile iterators?

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

 



Dr William Bland (wjb@xxxxxxxxxxxxxxxxxxxx) 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
 http://www.home.unix-ag.org/simon/gimp/guadec2002/gimp-plugin/html/efficientaccess.html

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

I hope this helps.

Bye,
        Simon

-- 
      Simon.Budig@xxxxxxxxxxx       http://www.home.unix-ag.org/simon/


[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