• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Problems with flipping an NSImage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems with flipping an NSImage


  • Subject: Problems with flipping an NSImage
  • From: "Aychamo Aychamo" <email@hidden>
  • Date: Tue, 17 Oct 2006 12:47:18 -0400

Hello

I'm trying to flip an NSImage so that it will be upside down (...)
I've searched the list's archives and have seen this done dozens of
times.  I've tried all their code, and it still wont' work for me.  I
must be doing something horribly wrong, but I can't seem to spot it.

The NSImage is drawn inside of one of my NSView subclasses -drawRect
method as follows:

// result is an NSImage that contains what I want to be flipped...

[result lockFocus];
NSAffineTransform *transform = [NSAffineTransform transform];
[transform scaleXBy: -1 yBy: 1];
[transform concat];
[result drawAtPoint:NSMakePoint(0,0) fromRect:NSMakeRect(0,0, [result
size].width, [result size].height) operation:NSCompositeCopy
fraction:1.0];
[result unlockFocus];

[result drawAtPoint: NSMakePoint(0,0) fromRect: NSZeroRect operation:
NSCompositeSourceOver fraction: 1.0];

// When result draws at the end, on the screen, it appears as normal,
as if it has not been flipped.

Does anyone know what I'm doing wrong?

Thank you
AA
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Problems with flipping an NSImage
      • From: "Shawn Erickson" <email@hidden>
    • Re: Problems with flipping an NSImage
      • From: Stephane <email@hidden>
  • Prev by Date: Re: NSOutlineView Row Heights
  • Next by Date: Re: Problems with flipping an NSImage
  • Previous by thread: Re: Re: Re: How to make my application open file directly from Finder?
  • Next by thread: Re: Problems with flipping an NSImage
  • Index(es):
    • Date
    • Thread