Hi Ulf, You're probably calling -setFlipped: on the images somewhere else. Don't do this.
The flipped attribute of NSImage is widely misunderstood. It describes the orientation of the internal coordinate system of the NSImage. Just as a superview never cares about the flippedness of its subviews, a user of an NSImage should not care about its flippedness. It's expected to be called only just after initialization by the person who created the image, if at all. A typical way people get confused here is to try to call [image setFlipped:[[NSGraphicsContext currentContext] isFlipped]] just prior to drawing, but this does not accomplish the intended goal. If called before caching, then representations end up caching upside down, and the flip is absorbed into the cache. If called after caching, it has no effect- the cached representation is already supposed to incorporate any necessary flipping. In particular, if the NSImage is drawn anywhere else later, it ends up upside down in _that_ place, which is also confusing because the bug and the expression of the bug are far apart. The alternative is to manipulate the graphics context instead of ever calling isFlipped. Here's some code (er, not tested, sorry), that will draw an image respecting isFlipped from the context. FYI, -[NSGraphicsContext isFlipped] matches -[NSView isFlipped] when drawing in a view (and not intentionally messing with things). @implementation NSImage (RespectFlipped) - (void)my_drawInRect:(NSRect)rect fromRect:(NSRect)fromRect operation:(NSCompositingOperation)op fraction:(CGFloat)delta respectContextFlipped:(BOOL)shouldRespectContextIsFlipped { NSAffineTransform *xAxisReflection = nil; NSRect destRect = rect; BOOL needReflection = shouldRespectContextIsFlipped && [[NSGraphicsContext currentContext] isFlipped]; if (needReflection) { xAxisReflection = [NSAffineTransform transform]; [xAxisReflection scaleXBy:1.0 yBy:-1.0]; [xAxisReflection concat]; destRect.origin.y = -rect.origin.y - rect.size.height; } [self drawInRect:destRect fromRect:fromRect operation:op fraction:delta]; if (needReflection) { [xAxisReflection concat]; } } @end -Ken Cocoa Frameworks On Thu, Oct 16, 2008 at 10:31 PM, Ulf Dunkel <[EMAIL PROTECTED]> wrote: > Noone out there who could give me a hint? > > ---snip--- > I wonder what I could have done wrong that all document and folder icons > which are automatically remembered and shown in our app's Open Recent > menu are shown upside down. > > As we didn't change anything related with openDocument: and don't > manipulate the Open Recent menu ourselves, I have no idea why the app > shows this behaviour under Leopard. Other apps don't show their document > or folder icons upside down in the Open Recent menu, so I really wonder > if we have forgotten to adjust some parameters for Leopard here. > ---snap--- > > > +bestRegards:Ulf > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com > > This email sent to [EMAIL PROTECTED] > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]