• 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
Drawing into an NSImage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Drawing into an NSImage


  • Subject: Drawing into an NSImage
  • From: "Gary J.H. Atkinson" <email@hidden>
  • Date: Wed, 17 Dec 2003 14:02:24 +0000

I have a large(ish) diagram which I want to render into an NSImage to create a small mimic.

I lock the focus on the image, set a scaling matrix to reduce the size of the diagram to fit the image.

Bezier paths and images render fine, but there is a problem with text. I'm using

drawAtPoint: withAttributes:

from NSString Additions.

The documentation states that this should only be used on an NSView which has the focus locked on it. It does render to an NSImage but only if the string would appear within the 'frame' of the image, i.e. the actual size of the ImageRep. It doesn't take into account the fact that I've applied a transformation to the context. So only text placed around then top-left of the diagram renders, (the NSImage is flipped).

Any suggestions for a workaround other than creating a large image the size of the diagram and then reducing that.

--
Gary J.H. Atkinson
_______________________________________________
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.

  • Prev by Date: Re: Developing for 10.3
  • Next by Date: CoreFoundation on Win32
  • Previous by thread: Re: NSSplitView hacking
  • Next by thread: CoreFoundation on Win32
  • Index(es):
    • Date
    • Thread