• 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: [Rubycocoa-talk] Alternative to NSGraphicsContext graphicsContextWithGraphicsPort:flipped:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Rubycocoa-talk] Alternative to NSGraphicsContext graphicsContextWithGraphicsPort:flipped:


  • Subject: Re: [Rubycocoa-talk] Alternative to NSGraphicsContext graphicsContextWithGraphicsPort:flipped:
  • From: Scott Thompson <email@hidden>
  • Date: Wed, 01 Jul 2009 17:20:16 -0500

On Wednesday, July 01, 2009, at 02:51PM, "Duncan McGregor" <email@hidden> wrote:
>Hi
>
>I'm writing PDF's with RubyCocoa, and want to set the current graphics
>context to a PDF context from CGPDFContextCreateWithURL so that I can
>draw on it.
>
>Essentially my code says (sorry, ObjC folks, Ruby follows)
>
>@pdf_context = CGPDFContextCreateWithURL(pdf_url, CGRectMake(0, 0,
>100, 100), nil)
>.....
>NSGraphicsContext.saveGraphicsState
>nscontext =
>NSGraphicsContext
>.graphicsContextWithGraphicsPort_flipped(@pdf_context, true)
>NSGraphicsContext.setCurrentContext(nscontext)
>
>My problem is that graphicsContextWithGraphicsPort:flipped: crashes
>RubyCocoa. It's a known issue, and has been fixed, but not shipped in
>10.5.7
>
>Can anyone suggest any workarounds that could get the pdf_context
>current?

If I understand... you're going all the way to NSGraphicsContext just to flip the coordinate system?  That's a long row to hoe :-).

Try something like (typed into mail)

CGContextTranslateCTM(pdf_context, 0, 100); # where 100 is the height of the context...
CGContextScaleCTM(pdf_context, 1.0, -1.0);

use that instead of trying to set the flipped bit.

Scott

_______________________________________________

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

  • Follow-Ups:
    • Re: Alternative to NSGraphicsContext graphicsContextWithGraphicsPort:flipped:
      • From: Duncan McGregor <email@hidden>
References: 
 >Alternative to NSGraphicsContext graphicsContextWithGraphicsPort:flipped: (From: Duncan McGregor <email@hidden>)

  • Prev by Date: Re: libcurl -- how to write a callback?
  • Next by Date: Re: libSystem.B.dylib
  • Previous by thread: Alternative to NSGraphicsContext graphicsContextWithGraphicsPort:flipped:
  • Next by thread: Re: Alternative to NSGraphicsContext graphicsContextWithGraphicsPort:flipped:
  • Index(es):
    • Date
    • Thread