Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 10-08-2008, 07:25 PM   #26 (permalink)
New Member
 
Join Date: Sep 2008
Posts: 4
Default EaglView ScreenShot

k, I'm trying the code suggested on a eaglView, but only getting a white image.

Quote:
CGRect screenRect = [[UIScreen mainScreen] bounds];
UIGraphicsBeginImageContext(screenRect.size);

CGContextRef ctx = UIGraphicsGetCurrentContext();
[glView.layer renderInContext:ctx];

UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

UIImageWriteToSavedPhotosAlbum(viewImage, self, nil, nil);
So it saves an image, but the image is just white, not the opengl scene I've rendered.

Thanks in advance for any help.

Phil
filharvey is offline   Reply With Quote
Old 10-12-2008, 06:18 PM   #27 (permalink)
Registered Member
 
Join Date: Oct 2008
Posts: 93
Default

I am all of a sudden getting the same problem as filharvey is. The code worked for a few days then suddenly stopped working.
I've tried two variations of the script as below and they both have the same results - "taking" a screen shot but adding only a white image to the photo library. Anyone have a guess as to what is going on?

Code:
//THIS WORKED THEN STOPPED WORKING
		UIGraphicsBeginImageContext(self.window.bounds.size);
		[self.window.layer renderInContext:UIGraphicsGetCurrentContext()];
		UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
		UIGraphicsEndImageContext();
		UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);

		//THIS IS NOT WORKING EITHER
		CGRect screenRect = [[UIScreen mainScreen] bounds];
		UIGraphicsBeginImageContext(screenRect.size);
		
		CGContextRef ctx = UIGraphicsGetCurrentContext();
		[[UIColor blackColor] set];
		CGContextFillRect(ctx, screenRect);
		
		[self.window.layer renderInContext:ctx];
		
		UIImage *screenImage = UIGraphicsGetImageFromCurrentImageContext();
		UIImageWriteToSavedPhotosAlbum(screenImage, nil, nil, nil);
		UIGraphicsEndImageContext();
fladnag is offline   Reply With Quote
Old 10-12-2008, 09:41 PM   #28 (permalink)
Registered Member
 
Join Date: Oct 2008
Location: Ohio
Posts: 32
Default

NEVERMIND

I originally had posted how to do a screen shot here, but then I saw that the poster knows how it's done - but wants to do it through code.

For some reason, it wont let me delete this post - so instead you're stuck reading garbage... sorry
__________________
www.sdkcoder.com
Are my posts helping you? Please help support my forum!
Aiming to be one of the most comprehensive iPhone resources on the net.

Last edited by Deklann; 10-12-2008 at 09:45 PM.
Deklann is offline   Reply With Quote
Old 01-24-2009, 01:37 AM   #29 (permalink)
Senior Member
 
MaCeXpErTo's Avatar
 
Join Date: Jul 2008
Posts: 149
Default

Quote:
Originally Posted by fladnag View Post
I am all of a sudden getting the same problem as filharvey is. The code worked for a few days then suddenly stopped working.
I've tried two variations of the script as below and they both have the same results - "taking" a screen shot but adding only a white image to the photo library. Anyone have a guess as to what is going on?

Code:
//THIS WORKED THEN STOPPED WORKING
		UIGraphicsBeginImageContext(self.window.bounds.size);
		[self.window.layer renderInContext:UIGraphicsGetCurrentContext()];
		UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
		UIGraphicsEndImageContext();
		UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);

		//THIS IS NOT WORKING EITHER
		CGRect screenRect = [[UIScreen mainScreen] bounds];
		UIGraphicsBeginImageContext(screenRect.size);
		
		CGContextRef ctx = UIGraphicsGetCurrentContext();
		[[UIColor blackColor] set];
		CGContextFillRect(ctx, screenRect);
		
		[self.window.layer renderInContext:ctx];
		
		UIImage *screenImage = UIGraphicsGetImageFromCurrentImageContext();
		UIImageWriteToSavedPhotosAlbum(screenImage, nil, nil, nil);
		UIGraphicsEndImageContext();
Did you ever fix it?
__________________
"I love this place"
MaCeXpErTo is offline   Reply With Quote
Old 01-24-2009, 01:42 AM   #30 (permalink)
Registered Member
 
RickMaddy's Avatar
 
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,122
Default

Search here for 'renderInContext'. There are several examples of rendering views to an image.
RickMaddy is offline   Reply With Quote
Old 01-24-2009, 01:47 AM   #31 (permalink)
Senior Member
 
MaCeXpErTo's Avatar
 
Join Date: Jul 2008
Posts: 149
Default

Quote:
Originally Posted by RickMaddy View Post
Search here for 'renderInContext'. There are several examples of rendering views to an image.
Thanks Rick!
__________________
"I love this place"

Last edited by MaCeXpErTo; 01-24-2009 at 01:52 AM.
MaCeXpErTo is offline   Reply With Quote
Old 03-05-2009, 03:33 AM   #32 (permalink)
New Member
 
Join Date: Feb 2009
Posts: 43
Default

I'm using this code to save my screen shot and its working:
Code:
	UIGraphicsBeginImageContext(Background.bounds.size);
	[Background.window.layer renderInContext:UIGraphicsGetCurrentContext()];
	UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
	UIGraphicsEndImageContext();
	
	UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
It works but I'm getting warnings now:

warning: no '-renderInContext:' method found
warning: (Messages without a matching method signature
warning: incomplete implementation of class 'VCMenu'
warning: method definition for '-renderInContext' not found
Dmoney is offline   Reply With Quote
Old 03-05-2009, 04:25 AM   #33 (permalink)
New Member
 
Join Date: Mar 2009
Posts: 5
Default

There are three applications that can be directly invoked (by just executing the program to take a screenshot, which can also be easily checked if you configure your Pocket PC to invoke the application straight from the Settings/Button applet or just click its icon in Start/Programs) and, therefore, be periodically run: PQV (for Portrait-only or game screenshot taking, strictly on QVGA devices), WebIS Inc.
Hilton is offline   Reply With Quote
Old 04-04-2009, 02:57 PM   #34 (permalink)
New Member
 
Join Date: Mar 2009
Posts: 8
Default

Is it possible to do homescreen screenshot with this code ?
I am trying to access to the homescreen view, but it doesn't work...
macounette is offline   Reply With Quote
Old 04-11-2009, 03:31 PM   #35 (permalink)
Registered Member
 
Join Date: Jan 2009
Posts: 17
Default

Quote:
Originally Posted by Dmoney View Post
I'm using this code to save my screen shot and its working:
Code:
	UIGraphicsBeginImageContext(Background.bounds.size);
	[Background.window.layer renderInContext:UIGraphicsGetCurrentContext()];
	UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
	UIGraphicsEndImageContext();
	
	UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
It works but I'm getting warnings now:

warning: no '-renderInContext:' method found
warning: (Messages without a matching method signature
warning: incomplete implementation of class 'VCMenu'
warning: method definition for '-renderInContext' not found

you need to import the Quartz framework into your app, then include the header:

Code:
#include <QuartzCore/QuartzCore.h>
cclaan is offline   Reply With Quote
Old 07-28-2009, 05:38 PM   #36 (permalink)
New Member
 
Join Date: Feb 2009
Posts: 3
Default

Quote:
Originally Posted by cclaan View Post
you need to import the Quartz framework into your app, then include the header:

Code:
#include <QuartzCore/QuartzCore.h>
Thanks for the tip. I have been trying to do a screenshot. It turns out to be so easy now.
starfall is offline   Reply With Quote
Old 09-07-2009, 07:56 AM   #37 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 2
Default

Quote:
Originally Posted by NewiPhoneDeveloper View Post
Would you happen to have an example of that emailing procedure?

Many thanks!
You can attach the file to the mail. It only supports iPhone OS 3.0 later.

Last edited by hicatchme; 09-07-2009 at 08:06 AM.
hicatchme is offline   Reply With Quote
Old 10-03-2009, 05:04 AM   #38 (permalink)
Registered Member
 
vikysaran's Avatar
 
Join Date: Jul 2009
Location: New Delhi
Posts: 129
Default

Quote:
Originally Posted by cclaan View Post
you need to import the Quartz framework into your app, then include the header:

Code:
#include <QuartzCore/QuartzCore.h>
its still showing 'Background Undecleared (first use of this function)'
__________________
Thanx & Regards-
Vaibhav Saran | Software Engineer
Neo Sypher Systems Pvt. Ltd.
New Delhi | India
Websites:
http://www.iphonesaura.com/
http://www.apptango.com/

vikysaran is offline   Reply With Quote
Old 10-03-2009, 05:23 AM   #39 (permalink)
Registered Member
 
vikysaran's Avatar
 
Join Date: Jul 2009
Location: New Delhi
Posts: 129
Default

Quote:
Originally Posted by fladnag View Post
I am all of a sudden getting the same problem as filharvey is. The code worked for a few days then suddenly stopped working.
I've tried two variations of the script as below and they both have the same results - "taking" a screen shot but adding only a white image to the photo library. Anyone have a guess as to what is going on?

Code:
//THIS WORKED THEN STOPPED WORKING
		UIGraphicsBeginImageContext(self.window.bounds.size);
		[self.window.layer renderInContext:UIGraphicsGetCurrentContext()];
		UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
		UIGraphicsEndImageContext();
		UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);

		//THIS IS NOT WORKING EITHER
		CGRect screenRect = [[UIScreen mainScreen] bounds];
		UIGraphicsBeginImageContext(screenRect.size);
		
		CGContextRef ctx = UIGraphicsGetCurrentContext();
		[[UIColor blackColor] set];
		CGContextFillRect(ctx, screenRect);
		
		[self.window.layer renderInContext:ctx];
		
		UIImage *screenImage = UIGraphicsGetImageFromCurrentImageContext();
		UIImageWriteToSavedPhotosAlbum(screenImage, nil, nil, nil);
		UIGraphicsEndImageContext();
i made a little modification and it is working here

Code:
	CGRect contextRect  = CGRectMake(50, 50, 200, 200);// whatever you need
	UIGraphicsBeginImageContext(contextRect.size);	

	[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
	UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
	UIGraphicsEndImageContext();
	UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
But the resulting image is starting from origin (0,0) of screen whether I'm giving anything for x and y. But height and width are working as defined.
thanx for the code anyway...
__________________
Thanx & Regards-
Vaibhav Saran | Software Engineer
Neo Sypher Systems Pvt. Ltd.
New Delhi | India
Websites:
http://www.iphonesaura.com/
http://www.apptango.com/


Last edited by vikysaran; 10-03-2009 at 06:13 AM.
vikysaran is offline   Reply With Quote
Old 10-07-2009, 03:34 AM   #40 (permalink)
Registered Member
 
vikysaran's Avatar
 
Join Date: Jul 2009
Location: New Delhi
Posts: 129
Thumbs up

refer http://www.iphonedevsdk.com/forum/ip...rge-issue.html

and http://www.iphonedevsdk.com/forum/ip...re-iphone.html

hope it helps
__________________
Thanx & Regards-
Vaibhav Saran | Software Engineer
Neo Sypher Systems Pvt. Ltd.
New Delhi | India
Websites:
http://www.iphonesaura.com/
http://www.apptango.com/

vikysaran is offline   Reply With Quote
Old 11-15-2010, 05:58 AM   #41 (permalink)
Registered Member
 
Join Date: Dec 2008
Posts: 83
Default

Quote:
Originally Posted by vikysaran View Post
i made a little modification and it is working here

Code:
	CGRect contextRect  = CGRectMake(50, 50, 200, 200);// whatever you need
	UIGraphicsBeginImageContext(contextRect.size);	

	[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
	UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
	UIGraphicsEndImageContext();
	UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
But the resulting image is starting from origin (0,0) of screen whether I'm giving anything for x and y. But height and width are working as defined.
thanx for the code anyway...
Did you find a solution about the problem it was starting at 0,0 ? I am looking for the same...
peterj is offline   Reply With Quote
Old 11-15-2010, 06:00 AM   #42 (permalink)
Registered Member
 
vikysaran's Avatar
 
Join Date: Jul 2009
Location: New Delhi
Posts: 129
Default

Quote:
Originally Posted by peterj View Post
Did you find a solution about the problem it was starting at 0,0 ? I am looking for the same...
not sure
but i think it will be working farmework 3.0+
__________________
Thanx & Regards-
Vaibhav Saran | Software Engineer
Neo Sypher Systems Pvt. Ltd.
New Delhi | India
Websites:
http://www.iphonesaura.com/
http://www.apptango.com/

vikysaran is offline   Reply With Quote
Old 09-26-2011, 10:38 AM   #43 (permalink)
Registered Member
 
Join Date: Sep 2011
Posts: 1
Default help

I am new in iphone please anybody help me for capturing signature of user from iphone screen and store it in sqlite.
sandeeptiwari is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 250
21 members and 229 guests
14DEV, @sandris, ADY, ArtieFufkin10, bookesp, ckgni, dacapo, Dani77, DarkAn, Desert Diva, HemiMG, iDifferent, jakerocheleau, JasonR, prchn4christ, Rudy, ryantcb, Speed, theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,230
Posts: 380,767
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:45 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0