Flipping an NSImage
Flipping an NSImage
- Subject: Flipping an NSImage
- From: Michael Becker <email@hidden>
- Date: Thu, 6 Oct 2005 19:11:04 +0200
Hi!
I am running into a very strange thing: I have a custom view that
displays portions of images in frames. My custom view is flipped, so
its coordinate origin is at the top left corner. My NSImages are all
flipped too so they draw correctly.
I am using NSImage's drawInRect:fromRect: method to draw the portions
of the images into the frames. If I call
[currentImage drawInRect:frameRect fromRect:NSMakeRect( 0, 0,
100, 100) ...
the upper left part of the image should be displayed, as the
fromRect:-rectangle starts at the image's (flipped) origin. So far so
good. However, *some* images still seem to have their origin in the
LOWER left corner. In that case, the code snippet I wrote would draw
the LOWER left part of the image into frameRect.
The images I use are various JPEGs coming from all kinds of sources
and I cannot see any obvious reason why some of them would behave
strangely when flipped.
I am not an expert at this flipping thing, but for *most* images it
works, and I cannot even determine whether an image will be
"different" beforehand.
I hope this made some sense and that somebody can help me out here...
Regards,
Michael
PS: Why did Apple put an NSView's coordinate origin into the lower
left corner? Almost every application I know has its natural
direction from top to bottom. Imagine surfing to a large website and
Safari will first show you the bottom of that page...
_______________________________________________
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