NSImage drawInRect: fromRect: operation: fraction causes the image to flip

When i use:

[iconImage drawInRect:NSMakeRect(cellFrame.origin.x+5,yOffset+3,cellFrame.size.height-6, cellFrame.size.height-6)
                     fromRect:NSMakeRect(0,0,[iconImage size].width, [iconImage size].height)
                    operation:NSCompositeSourceOver
                     fraction:1.0];

to draw some images in NSOutlineView cells, the images are vertically turned upside down. How can i fix this?

thank

+3
source share
1 answer

Use method

- (void)drawInRect:(NSRect)dstSpacePortionRect
          fromRect:(NSRect)srcSpacePortionRect
         operation:(NSCompositingOperation)op
          fraction:(CGFloat)requestedAlpha
    respectFlipped:(BOOL)respectContextIsFlipped
             hints:(NSDictionary *)hints

together with - (void)lockFocusFlipped:(BOOL)flipped

to draw the image upside down. From the NSImage Reference .

+7
source

All Articles