• 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: Creating an Offscreen NSView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating an Offscreen NSView


  • Subject: Re: Creating an Offscreen NSView
  • From: Mark Morrill <email@hidden>
  • Date: Fri, 20 May 2005 16:44:42 -0600

What I want to be able to do is to render an html page into an offscreen context and then create an image from it.

The advice from the Quartz list was to render the page in a WebView, create PDF data from it, render that into a CGBitmapContextRef, then pull the CGImageRef from that.

The key is this has to be done offscreen.

Mark

On 20-May-05, at 16:38, Shawn Erickson wrote:


On May 20, 2005, at 3:01 PM, Mark Morrill wrote:

Hi all,

Is creating an offscreen NSView as easy as:

    NSView* myOffscreenView = [[NSView alloc] initWithFrame:theFrame];

And is drawing into it as easy as:

    [myOffscreenView drawRect:myDrawRect];

Or getting PDF data from it as easy as:

    NSData* myPDF = [myOffscreenView drawRect:myDrawRect];

This seems to be too easy. Is there a catch? How does the view know not to draw on the screen? How does it allocate a graphics context?

You have a view that is not attached to any window so it does not have any context associated with it, it won't draw anything. Also drawRect: doesn't return anything (review the docs for NSView).


Anyway it isn't clear what you are trying to do... get a PDF of an existing view, simply draw into a PDF, etc.

-Shawn


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Creating an Offscreen NSView
      • From: Shawn Erickson <email@hidden>
References: 
 >Creating an Offscreen NSView (From: Mark Morrill <email@hidden>)
 >Re: Creating an Offscreen NSView (From: Shawn Erickson <email@hidden>)

  • Prev by Date: Re: "Selector not recognized" for existing selector : how is this possible??
  • Next by Date: Core Data, Document based app, and a structure
  • Previous by thread: Re: Creating an Offscreen NSView
  • Next by thread: Re: Creating an Offscreen NSView
  • Index(es):
    • Date
    • Thread