Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to determine a single pixels alpha?



unsigned char *pPixel = &pixels[ aPoint.x * 4 + aPoint.y * 4 * imageWidth ];

There's one too many multiplies in the code above.

int
pixIndex = 4 * (y*(int)imageSize.width+x);

Er, it works out the same (you've factored out the multiply by 4).

x * 4 + y * 4 * width = 4 * ( x + y*width)

Now, if "Width" is in bytes instead of pixels, there would be one too many multiplies.

Brian


References: 
 >Re: How to determine a single pixels alpha? (From: Brian Hook <email@hidden>)
 >Re: How to determine a single pixels alpha? (From: "John C. Randolph" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.