Images in NSImageViews are randomly turned upside down

So, I have this strange problem in my Cocoa application. A toolbar item, and some NSImageViews simply display the image in reverse for no apparent reason. The toolbar item actually appears this way when I launch the application for some reason (the icon is assigned by code), and then when I open my HUD with the finder zoom effect, the images contained in it look upside down.

alt text

This image above is a screenshot of this strange phenomenon. As you can see, the Show Cart item rotates strangely, each NSImageView in a HUD, but the NSImageView in NSBrowser is fine.

How can I track what causes this and then commit it?

+3
2

. Mac OS X - AppKit (Snow Leopard):

( 2009 )

, setFlipped:YES , . , . Leopard , NSToolbarItem ( setImage:) isFlipped. SnowLeopard SnowLeopard 10.6 SDK; , , Leopard, , .

SnowLeopard , , , setFlipped:YES - . , . . setFlipped: .

Re: setFlipped:

NSImage: deprecating - [NSImage setFlipped:], (New WWDC 2008)

NSImage . SnowLeopard, API .

NSImage. , , NSImage .

() [image setFlipped:[[NSGraphicsContext currentContext] isFlipped]] , . , , . , - . , NSImage - , , , . , . , , . -[NSImage isFlipped], . , , .

unflipped context, , flippedness. hints , -bestRepresentationForRect:context:hints:.

- (void)drawInRect:(NSRect)dstRect fromRect:(NSRect)srcRect operation:(NSCompositingOperation)op fraction:(CGFloat)alpha respectFlipped:(BOOL)respectContextIsFlipped hints:(NSDictionary *)hints;

YES respectFlipped, . , CTM , , CTM : . [[NSGraphicsContext currentContext] isFlipped]. CTM , -[NSGraphicsContext isFlipped]. .

-[NSImage setFlipped:] , -[NSImage lockFocus]. , , NSLayoutManager, . ,

- (void)lockFocusFlipped:(BOOL)flipped;

, . , (0,0) Y .

+13

, -setFlipped:YES.

+3

Source: https://habr.com/ru/post/1786825/


All Articles