• 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 an image in an NSImageView subclass
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rotating an image in an NSImageView subclass


  • Subject: Re: Rotating an image in an NSImageView subclass
  • From: Gregg Witmer <email@hidden>
  • Date: Fri, 11 Mar 2005 14:08:43 -0500


- (void) drawRect: (NSRect) rect
{
    [super drawRect: rect];
    [[NSGraphicsContext currentContext] saveGraphicsState];
    NSAffineTransform *transform = [NSAffineTransform transform];
    [transform rotateByDegrees: 180.0];
    [transform concat];
    [[NSGraphicsContext currentContext] restoreGraphicsState];
    [self setNeedsDisplay: YES];
}

For starters, move [super drawRect: rect]; to the end.

Secondly, don't call [self setNeedsDisplay: YES] from -drawRect, this will cause a constant stream of events calling -drawRect.

Third if the drawn image does get rotated (and I'm not sure that it will) you won't see it because you've rotated it out of the bounds of the view's rect. See: -translateXBy: yBy.

Gregg

_______________________________________________
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: Re: Is Mac Mini capable to develop cocoa app?
  • Next by Date: Re: Cocoa from C++ (dont want to mix it)
  • Previous by thread: Re: Rotating an image in an NSImageView subclass
  • Next by thread: SGSettingsDialog() in Cocoa
  • Index(es):
    • Date
    • Thread