• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Inverting an NSImage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inverting an NSImage


  • Subject: Re: Inverting an NSImage
  • From: "John C. Randolph" <email@hidden>
  • Date: Mon, 10 Feb 2003 14:17:27 -0800

On Saturday, February 8, 2003, at 07:51 AM, email@hidden wrote:

On samedi, fivrier 8, 2003, at 12:50 PM, Arthur VIGAN wrote:

Hi,

I have a black and white NSImage, and I would like to know if it is possible to invert this image (ie making white pixels black, and black pixels white)?

Link:

http://developer.apple.com/samplecode/Sample_Code/Graphics_2D/ Image_Difference.htm

This code can be optimized I think as it's using:

pixel = 255-pixel;

to invert the value, when this might be faster to do:

pixel=~pixel;

and this might be even 32 bits optimized for B&W Bitmaps.

Yes, I could have done it that way, and I could also have munged several
pixels at once with altivec code, but the idea in sample code is to make
it as clear as possible.

As for performance, the difference (if any) between bitwise inversion
and subtraction of an 8-bit constant is negligible.

-jcr


John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Inverting an NSImage (From: email@hidden)

  • Prev by Date: Re: Weird problem with array declaration in action
  • Next by Date: Re: Terminating an NSThread from another thread
  • Previous by thread: Re: Inverting an NSImage
  • Next by thread: Re: Inverting an NSImage
  • Index(es):
    • Date
    • Thread