Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question about dump a image representation of WebView



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



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.