• 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
converting to NSGraphicsContext coordinates?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Distributed Objects crash sending an NSImage
  • Next by Date: Re: Distributed Objects crash sending an NSImage
  • Previous by thread: Re: Distributed Objects crash sending an NSImage
  • Next by thread: NSLayoutManager stalls and never finishes layout
  • Index(es):
    • Date
    • Thread