Hello,
Please guys, I need your help on this. I'm using this code to render the contents of any NSView:
However, when I tried this with WebView, it seems that it can only render simple content (i.e. buttons, images, text) and it cannot render any video that's embedded in a website. Did I miss something here? Or this kind of behavior functions as designed by Apple?
Thanks!
Please guys, I need your help on this. I'm using this code to render the contents of any NSView:
Code:
+ (CGImageRef)allocCGImageRefFromView:(NSView*)theView
{
NSBitmapImageRep * bm = [NSBitmapImageRep alloc];
NSBitmapImageRep * newBM = nil;
[theView lockFocus];
[bm retain];
newBM = [bm initWithFocusedViewRect:[theView bounds]];
[newBM autorelease];
[theView unlockFocus];
//[bm retain];// data provider will release this
NSInteger rowBytes, width, height;
rowBytes = [bm bytesPerRow];
width = [bm pixelsWide];
height = [bm pixelsHigh];
CGDataProviderRef provider = CGDataProviderCreateWithData([bm autorelease], [bm bitmapData], rowBytes * height, BitmapReleaseCallback );
CGColorSpaceRef colorspace = CGColorSpaceCreateWithName( kCGColorSpaceGenericRGB );
CGBitmapInfo bitsInfo = kCGImageAlphaPremultipliedLast;
CGImageRef img = CGImageCreate( width, height, 8, 32, rowBytes, colorspace, bitsInfo, provider, NULL, NO, kCGRenderingIntentDefault );
CGDataProviderRelease( provider );
CGColorSpaceRelease( colorspace );
return img;
}
However, when I tried this with WebView, it seems that it can only render simple content (i.e. buttons, images, text) and it cannot render any video that's embedded in a website. Did I miss something here? Or this kind of behavior functions as designed by Apple?
Thanks!