• 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: Drawing Pixels with NSBezierPath
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drawing Pixels with NSBezierPath


  • Subject: Re: Drawing Pixels with NSBezierPath
  • From: Scott Thompson <email@hidden>
  • Date: Tue, 6 Jul 2004 22:37:33 -0500

Use OpenGL.

<http://developer.apple.com/opengl>
<http://developer.apple.com/documentation/Cocoa/Conceptual/OpenGL>

Create a rectangular texture the same size as your view's bounds, and set the context to per-pixel orthogonal projection. Enable client storage and texture range, and texture priority 0. Now you can write into the texture's memory buffer and store direct pixel color values, using row/col indexing. Many ways to do what you want with the pixels. Your speed should increase a hundred-fold, and it's only a little more complicated to support hardware that requires power-of-2 texture sizes (ATI Rage 128/Pro/M3).

Another option would be to allocate a pixel buffer yourself, set up the pixels the way you want them to look, then use Core Graphics to create a CGImage from that pixel buffer. This is conceptually similar to the OpenGL route, but will require a lot less overhead to setup and use.

For that matter you could probably create an NSBitmapImageRep from your pixel buffer, create an NSImage from that, and use NSImage's drawing routines to get much the same effect.

Scott
_______________________________________________
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: 
 >Drawing Pixels with NSBezierPath (From: "Christopher O'Neill" <email@hidden>)
 >Re: Drawing Pixels with NSBezierPath (From: Shaun Wexler <email@hidden>)

  • Prev by Date: Re: applicationDockMenu: woes
  • Next by Date: Re: erasing, redrawing NSBezierPath into and NSImage problem
  • Previous by thread: Re: Drawing Pixels with NSBezierPath
  • Next by thread: Misc questions
  • Index(es):
    • Date
    • Thread