Le 24 août 08 à 05:55, John C. Randolph a écrit :


On Aug 23, 2008, at 2:51 PM, Shawn Erickson wrote:

On Fri, Aug 22, 2008 at 2:54 AM, Eduardo Areitio <[EMAIL PROTECTED]> wrote:
I'm trying to read individual pixel values in a monochrome image using
NSReadPixel, but I haven't  been able to.

I would much appreciate anyone's help

It is usually best to post some code or better explain what you tried
and what is going wrong otherwise we have to guess at the difficulty
you are having.

Anyway...

http://developer.apple.com/samplecode/Color_Sampler/listing5.html

You'll notice from the comments in that sample, that NSReadPixel() gets a value from the graphics context that has the current drawing focus. If you're trying to read a value from an image, you've got to have somewhere to draw it first.

You can get the image context directly using -[NSImage lockFocus].
No need to draw it before.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to