On Jan 23, 2008 11:32 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Thank you very much.  This has cleared up the problem entirely,
> although I had to use the formula:
>
> image.data[(y+1) * image.pitch + x * 4 + 3]
>
> Any idea of why that might be?

If image.pitch is negative, then your +1 is needed (and rows are
indexed top-to-bottom, not bottom-to-top).  A more robust approach is:

image.data[y * abs(image.pitch) + x * 4 + 3]

and count rows from the bottom.

> Format is BGRA.  Will this formula change depending on the format?

y * abs(image.pitch) selects the row
x * 4 selects the pixel (4 components per pixel here; so if format was
RGB you'd multiply by 3)
+ 3 selects the alpha component (ARGB would be +0).

Alex.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to