Re: How to determine a single pixels alpha?
Re: How to determine a single pixels alpha?
- Subject: Re: How to determine a single pixels alpha?
- From: "Kenneth C. Dyke" <email@hidden>
- Date: Sun, 30 Sep 2001 16:42:56 -0700
On Sunday, September 30, 2001, at 04:12 PM, Peter Ammon wrote:
Try alpha=*(pixels + [bitmap pixelsWide]*[bitmap
samplesPerPixel]*(int)aPoint.y + (int)aPoint.x * [bitmap
samplesPerPixel] + 3);
I'm not just picking on Peter here, but how about:
alpha=*(pixels + [bitmap bytesPerRow]*(int)aPoint.y + (int)aPoint.x *
[bitmap samplesPerPixel] + 3)
It's not a good idea to assume that bytesPerRow is always equal
width*bytesPerPixel. It's also probably not wise to assume that
samples==bytes, either, but fixing that is left as an exercise for the
reader. ;)
-Ken
Kenneth Dyke, email@hidden (personal), email@hidden (work)
Sr. Mad Scientist, MacOS X OpenGL Group, Apple Computer, Inc.
C++ is to C as Lung Cancer is to Lung