-1

I've drawn onto an NSView which displays fine except for the fact it was flipped. I've set isFlipped to YES so it displays the correct way round.

I then overlay an image using drawInRect and [super drawRect:dirtyRect];

The problem is the overlayed image is now flipped incorrectly. How can I flip the main drawing but leave the overlayed image unflipped?

  • Is this about the (buggy) QR-code drawing code from the other questions? – Willeke Nov 11 '21 at 22:39
  • 1
    so my answer to your earlier question – Ol Sen Nov 12 '21 at 01:14
  • You cracked it thanks for your help Ol Sen :) And Willeke no this is for something different - i'm playing around with drawing in general as i'm trying to learn - this is still very new to me so i'm trying to understand how everything works so I really appreciate everyones help I hope some day I will be as good of a coder as you guys :) – GeraldTheGerm Nov 12 '21 at 09:53

1 Answers1

1

You might try using NSImage's drawInRect:fromRect:operation:fraction:respectFlipped:hints: method rather than drawInRect::

[image drawInRect:rect
         fromRect:NSZeroRect
        operation:NSCompositeSourceOver
         fraction:1.0
   respectFlipped:NO
            hints:nil];

Passing NO for respectFlipped: may give you what you're looking for.

NSGod
  • 22,699
  • 3
  • 58
  • 66
  • Thanks that was helpful to know unfortunately why it did flip the image it's Y positioning was reversed but Ol Sen helped me out :) I'll give you an upvote still as this may come in handy to know down the line! – GeraldTheGerm Nov 12 '21 at 09:51