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 > CoreGraphics ?

CoreGraphics ?
Thread Tools
Junior Member
Join Date: Sep 2000
Location: Bremen, Germany
Status: Offline
Reply With Quote
May 25, 2002, 06:47 AM
 
I want to draw two (or more) NSBitmapImageRep (initialized with jpegs) into another NSBitmapImageRep which is created on the fly using the "initWithBitmapDataPlanes" method. One possibility to do this is creating a core graphics context, core graphics image references and draw them into the context. But I don't like pure c code in my app and would like to know if there's any way to get a NSGraphicsContext from a NSImageRep ? Then I could use the NSImageReps draw method ....

Any ideas ?

[ 05-25-2002: Message edited by: mahrz ]
"Eine gute Basis ist die Grundlage für ein solides Fundament", Unknown
"If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is", John von Neumann
     
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status: Offline
Reply With Quote
May 25, 2002, 10:11 AM
 
Create a new NSImage, send it a lockFocus, draw your two NSBitmapImageReps into it, and unlock focus. Now, you've got an NSImage that contains a private subclass of NSImageRep (it's a cached representation). You can get this into an NSBitmapImageRep by again locking focus on your NSImage and initing an NSBitmapImageRep using the initWithFocusedRect method.

Use TIFFRepresentation to get jpg data back out again.

(disclaimer - this is all from memory, I may have gotten names totally freakin' wrong)
Geekspiff - generating spiffdiddlee software since before you began paying attention.
     
mahrz  (op)
Junior Member
Join Date: Sep 2000
Location: Bremen, Germany
Status: Offline
Reply With Quote
May 25, 2002, 02:11 PM
 
Originally posted by smeger:
<STRONG>Create a new NSImage, send it a lockFocus, draw your two NSBitmapImageReps into it, and unlock focus. Now, you've got an NSImage that contains a private subclass of NSImageRep (it's a cached representation). You can get this into an NSBitmapImageRep by again locking focus on your NSImage and initing an NSBitmapImageRep using the initWithFocusedRect method.

Use TIFFRepresentation to get jpg data back out again.

(disclaimer - this is all from memory, I may have gotten names totally freakin' wrong)</STRONG>
Is the current graphics context the context of the image when I call lockFocus ?
"Eine gute Basis ist die Grundlage für ein solides Fundament", Unknown
"If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is", John von Neumann
     
   
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 03:04 PM.
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