Re: Rotating NSImage?
Re: Rotating NSImage?
- Subject: Re: Rotating NSImage?
- From: "Dennis C. De Mars" <email@hidden>
- Date: Thu, 7 Jun 2001 22:46:14 -0000
Clyde McQueen <email@hidden> said:
>
Should I expect NSImage objects to rotate when I rotate the enclosing
>
view? I've tried two ways:
>
>
1. An NSImageView set up in IB.
>
2. A custom view with:
>
>
- (void)drawRect:(NSRect)aRect
>
{
>
NSRect bounds = [self bounds];
>
NSImage *image = [[[NSImage alloc]
>
initByReferencingFile:PICTURE_PATH] autorelease];
>
NSPoint p;
>
>
p.x = bounds.origin.x + bounds.size.width / 2;
>
p.y = bounds.origin.y + bounds.size.height / 2;
>
>
[image compositeToPoint:p operation:NSCompositeCopy];
>
>
// ... and some NSBezierPaths so I can see the rotation...
>
}
>
>
In all cases the images show up just fine, but they appear to ignore the
>
rotation. What did I forget to do, or is this a limitation of NSImage?
>
Take a look at the NSImage documentation, under the heading "Coordinate Systems"
You can do this with a custom view, but you have to use drawToPoint: rather than
compositeToPoint: . The former rotates the image to match view coordinate system, the
latter orients the image using the base coordinate system.
- Dennis D.