Re: NSImage and flipping
Re: NSImage and flipping
- Subject: Re: NSImage and flipping
- From: "Louis C. Sacha" <email@hidden>
- Date: Sat, 14 Feb 2004 12:02:09 -0800
Hello...
For an NSImage, the "flipped" state refers to the destination view
where the image will be composited, not the source view. So, all you
probably have to do is not call setFlipped:YES...
When a view uses flipped coordinates (or scaling or transformations,
etc), for the most part it is an internal decision that affects how
the code within that view's implementation works and draws. Once the
view draws itself in a window or image, the view's orientation isn't
recorded, just the raw pixels, essentially with the pixel data always
being in an "unflipped" form regardless of the coordinate system
actually in use by the view that did the drawing.
So when you have the pixel data in an NSImage, it is in a generic
unflipped state, the way it would have appeared on screen. If you
then draw /composite the image in any view with the standard
unflipped coordinate system, it will work correctly.
The reason that NSImage has the setFlipped: method is to allow images
to be drawn/composited correctly in flipped views (the destination)
since otherwise the image would appear upside down. Likewise, if you
use setFlipped:TRUE on an image and then draw it in an unflipped view
(the destination) then it will also appear upside down.
I'm sure someone else can explain it more clearly than that, but
hopefully it helps...
Louis
I am trying to implement dragging from a custom view. The view is
flipped to make text-rendering work correctly. To drag a piece of
graphic from the view I create a NSImage. To get it to render the
text correctly I use SetFlipped:YES. Or so I thought... The image
comes out upside down!
Changing isFlipped in a NSView changes the order of the lines of the
text rendered.
Changing isFlipped in a NSImage turns the image upside down.
Why the difference in behaviour?
Could anybody tell me what I am missing here. And what is the solution?
regards
Bjvrn Carlstrvm
_______________________________________________
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.