Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Double buffering or painting on images

Double buffering or painting on images
Thread Tools
Fresh-Faced Recruit
Join Date: Nov 2001
Location: home
Status: Offline
Reply With Quote
Jul 21, 2005, 04:15 PM
 
How does one draw on NSImages? I want to render a particular image, save it to a buffer, then draw that buffer onto the window. This rendering consists just of drawing lines, circles, and text. NSBezierPath is probably too powerful for this task, but Cocoa doesn't seem to have many other options. I'm aware of doing it with CGBitmapContext in Carbon, but using Cocoa's classes is far, far easier than Carbon's. I mean, what's the deal with CGDataProvider? Using CGImageCreate() uses so many lines of code; you have to create a CGColorSpace and CGDataProvider before even thinking of creating a CGImage. Using Cocoa-only classes seems to be a lot easier.
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jul 21, 2005, 04:28 PM
 
See the docs for -[NSImage lockFocus].

However, windows are double-buffered by default. Double-buffering yourself just seems wasteful.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:22 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2