• 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
Pasting a PDF image in text: NSCGImageSnapshotRep and upside down drawing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pasting a PDF image in text: NSCGImageSnapshotRep and upside down drawing


  • Subject: Pasting a PDF image in text: NSCGImageSnapshotRep and upside down drawing
  • From: Gideon King <email@hidden>
  • Date: Mon, 28 Mar 2011 03:21:39 +1000

Hi, I am trying to work out an issue with some text editing and drawing.

I paste a PDF image file into some text that is being edited using a text view, and as expected, the text storage gets a text attachment with an image with a PDF image rep passed to it. Then by the time it gets to textStorageWillProcessEditing, the image is the same but the PDF rep has been swapped out and an NSCGImageSnapshotRep has been substituted. I presume it is caching it as a bitmap for drawing performance reasons.

For some reason, when I try to draw this text using drawGlyphsForGlyphRange:atPoint:, these images are being drawn upside down (while editing in a text view, they appear the right way up). Even if I go through all the images in the text and turn on setFlipped, it makes no difference - they still draw upside down.

When I save the file and load it again, it loads the PDF images and they draw the right way up. This only seems to happen with PDF images - other formats work fine (I do need to flip them seeing as I am working in a flipped coordinate system when I draw the string).

It seems that I need to either avoid them being turned into the snapshot rep, or replace the rep with the PDF rep or something to be able to work around this problem.

Has anyone else encountered these problems? Any suggestions on a good approach?

Thanks

Gideon_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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

  • Prev by Date: Re: Hash Values in Custom Classes
  • Next by Date: Re: copyPath:toPath:handler: more reliable than copyItemAtPath:toPath:error: ???
  • Previous by thread: Re: Trouble with NSView resizing
  • Next by thread: GCD dispatch workers and termination
  • Index(es):
    • Date
    • Thread