Re: Drawing an NSImage in a view with flipped coordinates
Re: Drawing an NSImage in a view with flipped coordinates
- Subject: Re: Drawing an NSImage in a view with flipped coordinates
- From: Ricky Sharp <email@hidden>
- Date: Mon, 28 Feb 2005 14:17:15 -0600
On Monday, February 28, 2005, at 01:49PM, Derrick Griffel <email@hidden> wrote:
>I'm trying to draw an image in a view that has flipped coordinates. My
>view has to have flipped coordinates because I am using rulers and I
>would like the origin of the rulers in the upper left corner. I was
>originally using [NSImage setFlipped:YES] prior to locking focus,
>creating a new NSImageRep, unlocking focus, and then using [NSImageRep
>drawInRect]. This resulted in my image getting drawn correctly with
>one exception. Using this design, some EPS images would not scale up
>correctly. To overcome the scaling problem, I added a call to [NSImage
>setDataRetained:YES]. This fixed the scaling problem, however, none of
>the images obey the setFlipped flag anymore resulting in all my images
>being drawn upside down. If I remove the call to setDataRetained, the
>images are once again drawn in the correct orientation, but then I am
>still faced with the scaling problem with certain EPS images.
Rather than setting the flipped flag on the images, try setting up a 'flip' transform in the current context just prior to drawing your images. That should work and will hopefully allow you to keep the EPS workaround in place.
--
Rick Sharp
Instant Interactive(tm)
_______________________________________________
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