• 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
Re: Rotating NSImage?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Rotating NSImage? (From: Clyde McQueen <email@hidden>)

  • Prev by Date: Re: Getting started with Cocoa
  • Next by Date: Re: Rotating NSImage?
  • Previous by thread: Rotating NSImage?
  • Next by thread: Re: Rotating NSImage?
  • Index(es):
    • Date
    • Thread