Hi All:
In my program, I want to dump a image of Webview. I use two ways to do this:
NSBitmapImageRep *imgrep;
docView = [[[webview mainFrame] frameView] documentView];
1.
if ([docView lockFocusIfCanDraw]) {
imgrep = [[NSBitmapImageRep alloc]
initWithFocusedViewRect:[docView visibleRect]];
[docView unlockFocus];
}
2.
imgrep = [docView bitmapImageRepForCachingDisplayInRect:[docView visibleRect]];
[docView cacheDisplayInRect:[docView visibleRect] toBitmapImageRep:imgrep];
These 2 works fine when html page does NOT contain flash.To force
drawing flash onto the cached image, I modified the first one:
3.
if ([docView lockFocusIfCanDraw]) {
[docView drawRect:[docView visibleRect]];
NSArray * subViews = [docView subviews];
for (int idx = 0; idx<[subViews count]; idx++) {
NSView * subView = (NSView *)[subViews objectAtIndex:idx];
[subView drawRect:[subView visibleRect]];
}
[docView displayRect:[docView visibleRect]];
imgrep = [[NSBitmapImageRep alloc]
initWithFocusedViewRect:[docView visibleRect]];
[docView unlockFocus];
}
This code can work if safari with flash plugin versioin 7.0, but fail on 8.0.
Any one can help to test this and figure out some correct ways?
Thanks
Huaixing
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webkitsdk-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webkitsdk-dev/email@hidden
This email sent to email@hidden