converting to NSGraphicsContext coordinates?
converting to NSGraphicsContext coordinates?
- Subject: converting to NSGraphicsContext coordinates?
- From: Steve Gehrman <email@hidden>
- Date: Fri, 28 Oct 2005 16:08:05 -0700
I'm trying to emulate cacheDisplayInRect (cacheDisplayInRect doesn't
image antialised text correctly)
The problem is I can't figure out the formula for converting a views
bounds to the zero origin of a new graphics context.
Anyone know how? I hard coded values that work for now.
image = [[[NSImage alloc] initWithSize:size] autorelease];
[image lockFocus];
{
// clear image, we might be reusing an image
[NSBezierPath eraseRect:rect];
// hard coded adjustment to line up my rect with the new graphics
contexts 0,0
NSAffineTransform *transform = [NSAffineTransform
transform];
[transform translateXBy:-10 yBy:-13];
[transform concat];
rect.size.width += 20;
rect.size.height += 26;
// end hard coded values
[self displayRectIgnoringOpacity:rect inContext:
[NSGraphicsContext currentContext]];
result = [[[NSBitmapImageRep alloc]
initWithFocusedViewRect:rect] autorelease];
}
[image unlockFocus];
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden