• 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
Re: NSImage and flipping
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage and flipping


  • Subject: Re: NSImage and flipping
  • From: "Louis C. Sacha" <email@hidden>
  • Date: Sun, 15 Feb 2004 00:40:22 -0800

Hello...

I didn't realize that you were trying to draw the text in the actual NSImage, not copying it from a view where you were drawing.

The effects you are talking about are what I meant when I said that the source for the NSImage is always unflipped, and that the NSImage method setFlipped: only affects the way the image is drawn/displayed in the destination. When you draw into an NSImage, the coordinate system is always the standard unflipped coordinate system, and it can't be changed easily the way the coordinate system of a view can (theoretically it could be done, but NSCachedImageRep --which is in charge of the actual image data when you draw into an NSImage-- is not designed to work that way).

If the text is already being drawn in the view you are dragging from, it would probably be easier to create the image using the NSView instance method dataWithPDFInsideRect: or dataWithEPSInsideRect: and then creating an NSImage from the resulting data using the NSImage initializer initWithData:.

If that solution won't work for you, and no one else has posted a better way, post again and I will try to put together some code that will allow you to draw into an NSImage the way you want...

Louis


2004-02-14 kl. 21.02 skrev Louis C. Sacha:

Hello...

For an NSImage, the "flipped" state refers to the destination view where the image will be composited, not the source view. So, all you probably have to do is not call setFlipped:YES...

Well that's just what I thaught. Unfortunately it doesn't work. In an ordinary NSView toggeling the flipped state affects the order of multiline text rendering. If its not flipped the text comes out like this:

out like this
the text comes

Setting it to flipped makes Cocoas text rendering put the lines in the correct order. When using the same code to draw text in an NSImage that is not flipped. The text comes out the same way. That is:

out like this
the text comes

This is clearly not what I want. But if I set the the flipped state to true in an NSImage I don't get the same result as in an NSView. Instead the finished graphic (the pixels) comes out upside down. This is not what I want either.

Thank you anyway. If you have any ideas please let me know.


Bjvrn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >NSImage and flipping (From: Björn Carlström <email@hidden>)
 >Re: NSImage and flipping (From: "Louis C. Sacha" <email@hidden>)
 >Re: NSImage and flipping (From: Björn Carlström <email@hidden>)

  • Prev by Date: General Question: Debugging these "NS" Objects
  • Next by Date: Re: General Question: Debugging these "NS" Objects
  • Previous by thread: Re: NSImage and flipping
  • Next by thread: Re: NSImage and flipping
  • Index(es):
    • Date
    • Thread