• 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 Images....
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rotating Images....


  • Subject: Re: Rotating Images....
  • From: Allan Odgaard <email@hidden>
  • Date: Sun, 27 Jun 2004 05:31:00 +0200

On 27. Jun 2004, at 2:06, Jerry LeVan wrote:

About all I can do is produce "kaleidoscopes"...

NSSize imageSize; // Size of the image to draw

NSSize scaledRect;
NSImage *tmpImage=NULL;
float scaleFactor=[theSlider floatValue];
tmpImage = [anImage copy];

I think this should be:
tmpImage = [[NSImage alloc] initWithSize:imgSize];

Where imgSize should probably be (if you also wanted to scale):
NSSize imgSize = [anImage size];
imgSize.width = ceilf(imgSize.width * scaleFactor);
imgSize.height = ceilf(imgSize.height * scaleFactor);

Because you want a blank image to draw the rotated version into (by using copy you basically draw on top of the old image).

Btw: the save/restore graphics context is not necessary, since a new context is setup when you send lockFocus to the image.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Rotating Images....
      • From: Jerry LeVan <email@hidden>
References: 
 >Rotating Images.... (From: Jerry LeVan <email@hidden>)

  • Prev by Date: Re: URL formatting in NSAttributedString
  • Next by Date: Re: Cocoa Java resources?
  • Previous by thread: Rotating Images....
  • Next by thread: Re: Rotating Images....
  • Index(es):
    • Date
    • Thread