Re: NSImage problems
Re: NSImage problems
- Subject: Re: NSImage problems
- From: James Chen <email@hidden>
- Date: Mon, 11 Jun 2007 15:18:56 +0800
- Thread-topic: NSImage problems
Hi,
I think that's because the row bytes alignment.
Turn your loop into:
for ( y = 0; y < h; y++ ) {
for ( x = 0; x < w; x++ ) {
p1 = srcData + n * (y * bytesPerRow + x);
p2 = destData + y * bytesPerRow + x;
rr=*(p1+a0) + *(p1 + 1+a0) + *(p1 + 2+a0);
*p2 = (char)(rr/3);
}
}
HTH!
Best Regards,
James Chen
Presentation Product Division
TEL: +886 2 22263630 ext 8538
FAX: +886 2 22267241
Mailto: email@hidden
http://www.avermedia.com
AVerMedia Technologies, Inc.
簡報產品事業單位: 陳銘崧
圓剛科技(股)公司
This message contains information that may be confidential and privileged.
Unless you are the addressee (or authorized to receive messages for the
addressee), you cannot use, copy or disclose to any third party or any
information contained in the message. If you have received the message in
error, please advise the sender by reply e-mail and delete the message.
Nothing in this message should be interpreted as a digital or electronic
signature that can be used to authenticate a contract or to other legal
document. Thank you very much.
> From: Barry <email@hidden>
> Date: Sat, 9 Jun 2007 18:00:21 +0100
> To: Cocoa-list <email@hidden>
> Subject: NSImage problems
>
>
> I'm attempting to learn cocoa programming within Xcode.
> I need to write an app which filters images - producing six-color separations.
> I've already done this for windows so have the C code ready, just need the GUI
> - Cocoa promises to offer just that !
> I downloaded one of Michael Beam 's example from
>
>
> http://www.oreillynet.com/mac/2002/08/06/examples/ImageApp4.sit
>
> but cannot get it to work. It uses NSImage's to make a grayscale version of a
> supplied image.
>
> I have placed a before & after screen grab plus the relevant code at
>
> http://homepage.ntlworld.com/barrypalmer/
>
> I have stepped through with the debugger & cannot see any problem
>
> Any advice would be welcomed
>
> Barry
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden