Re: - [NSBitmapImageRep cacheDisplayInRect:toBitmapImageRep:] produces empty image
Re: - [NSBitmapImageRep cacheDisplayInRect:toBitmapImageRep:] produces empty image
- Subject: Re: - [NSBitmapImageRep cacheDisplayInRect:toBitmapImageRep:] produces empty image
- From: "Adam R. Maxwell" <email@hidden>
- Date: Wed, 19 Aug 2009 20:49:41 -0700
On Aug 19, 2009, at 8:39 PM, Ben Lachman wrote:
On Aug 19, 2009, at 8:45 PM, Adam R. Maxwell wrote:
On Aug 19, 2009, at 2:50 PM, Ben Lachman wrote:
I have an offscreen window containing a WebView that I'm using to
generate web previews. My current code works beautifully and
looks like this:
NSView *view = previewWebView.mainFrame.frameView.documentView;
I do something similar, although using the frameView directly (and
drawing to a CGContext). Do you really need to draw the
documentView?
If I use the frameView I get scrollers in the generated image. How
do you avoid getting scrollers?
WebFrameView *view = [[_webView mainFrame] frameView];
[view setAllowsScrolling:NO];
Incidentally, this is the call that broke things in Safari 4.0.3, so
if you're not using it, you're likely running into something else :).
This is easier than messing about with the documentView, though, in my
opinion.
Have you tried sending -layout to the documentView before drawing?
Safari 4.0.3 broke my code (I started getting blank image), and
that was the workaround I came up with.
Hadn't tried it but it doesn't seem to make a difference to my
problem. Mind posting your code? (My plan is to release a web
preview generator class so that others don't have to continually
roll their own once mine is working correctly).
Sure. It's BSD licensed, and available at
http://code.google.com/p/fileview/source/browse/trunk/fileview/FVWebViewIcon.m
The drawing bits are in -[FVWebViewIcon _pageDidFinishLoading]. The
hardest part of the whole thing is figuring out when a page is
completely loaded, but it's commented fairly extensively. Let me know
if you have questions.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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