Quote:
Originally Posted by digicide
There is a private method imageWithScreenContents() that will take a screenshot programmatically. Officially Apple doesn't allow private methods to be used, but in this case I doubt they'd notice. Here's a usage example (from code by Rob Terrell)
Code:
+ (UIImage *)imageWithScreenContents
{
CGImageRef cgScreen = UIGetScreenImage();
if (cgScreen) {
UIImage *result = [UIImage imageWithCGImage:cgScreen];
CGImageRelease(cgScreen);
return result;
}
return nil;
}
Now that we have that sorted, PLEASE tell me how you were able to use GLPaint above a UIImage. No matter what I try, the blending seems to be off and there's either dark edges to the lines, or the colors are inverted... I've been at this several days now.
|
Actually, I even managed to work around that private API and get the same effect, using officially allowed methods only
Anyways, first things first. To show the UIImage below your EAGLView, you have to do 2 things:
1) in your EAGLView.m set:
Code:
eaglLayer.opaque = NO;
//I'm using EAGLView version 1.6 - can be found in -(BOOL) _createSurface method
This will make the EAGLView transparent.
2) In GLPaint PaintingView gets directly called from the AppDelegate. Therefore it lays on the AddDelegate's window. Now simply set your image as your window's background image, like:
Code:
UIImage *patternImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"nameOfYourImage" ofType:@"png"]];
[self.window setBackgroundColor:[UIColor colorWithPatternImage:patternImage]];
Hope, that helps...