Re: Need to draw a NSImage into a graf port
Re: Need to draw a NSImage into a graf port
- Subject: Re: Need to draw a NSImage into a graf port
- From: Florent Pillet <email@hidden>
- Date: Sun, 23 Nov 2003 11:27:01 +0100
I have everything you need for that in the "NSImage (PalmExtensions)"
category, part of my osx-palm-tools project (BSD licensed). Here is the
URL for the source code:
http://cvs.sourceforge.net/viewcvs.py/osx-palm-tools/PalmServices/
(get the NSImage-PalmExtensions.{h,m} files)
Specifically, you'll want to do:
NSRect r = [myImage rect];
Rect bounds = {0, 0, r.size.height, r.size.width};
PicHandle pictDataH = [myImage PICTHandle];
CGrafPtr oldPort;
GDHandle oldGD;
GetGWorld(&oldPort, &oldGD);
LockPixels(GetGWorldPixMap(myGWorld));
SetGWorld(myGWorld, NULL);
DrawPicture(pictDataH, &bounds);
SetGWorld(oldPort, oldGD);
UnlockPixels(GetGWorldPixMap(myGWorld));
I guess that given the number of requests for that kind of stuff I see
in the forum, I should make the image manipulation code a generic
category and put it in a separate place on the web...
Hope this helps,
Florent
On 23 nov. 03, at 03:32, Scott Chandler wrote:
Any suggestions on how best to do this? Specifically we are trying to
draw a EPS image into a CGrafPort. We don't care how we get it in
there, but ultimately it must end up in a CGrafPort.
I see that the Web Kit has a ConvertNSImageToCGImageRef() or some such
routine, but it requires having Safari installed...a requirement we
may not be able to make.
--
Florent Pillet, Code Segment email@hidden
Developer tools and end-user products for Palm OS & Mac OS X
ICQ: 117292463
http://perso.wanadoo.fr/fpillet
_______________________________________________
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.