• 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: drawing text onto an NSImage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: drawing text onto an NSImage


  • Subject: Re: drawing text onto an NSImage
  • From: Douglas Davidson <email@hidden>
  • Date: Fri, 1 Dec 2006 13:24:36 -0800


On Dec 1, 2006, at 12:47 PM, Ben Zotto wrote:

I would like to pre-cache some of this drawn text in some cases by
drawing into an NSImage (using the 10.3 lockFocus/draw/unlockFocus
technique) before compositing it to the screen. The NSImage has been set to flipped, but the text still
comes out wrong on it, with each individual line being vertically
mirrored, something that (unless I'm not bright enough to get it) can't
be fixed by applying an NSAffineTransform. Calling [[NSGraphicsContext
currentContext] isFlipped] returns NO when drawing to the image, which
is implied by the documentation and I assume somewhere at the cause of the problem.

Here is something adapted from currently working code, showing how to draw text into an NSImage:


    image = [[NSImage alloc] initWithSize:size];
    [image setFlipped:YES];
    [image lockFocus];
    [layoutManager drawGlyphsForGlyphRange:glyphRange atPoint:point];
    [image unlockFocus];

Douglas Davidson

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >drawing text onto an NSImage (From: Ben Zotto <email@hidden>)

  • Prev by Date: drawing text onto an NSImage
  • Next by Date: ANN: BaseTen DP1 (Cocoa database framework)
  • Previous by thread: drawing text onto an NSImage
  • Next by thread: RE: drawing text onto an NSImage
  • Index(es):
    • Date
    • Thread