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

View Single Post
Old 05-22-2008, 08:29 AM   #3 (permalink)
realberen
New Member
 
realberen's Avatar
 
Join Date: Apr 2008
Posts: 60
Default Re: Getting data from an UIImage

Thanks for the tip, bonehead. Would this seem like a good way to go about doing that? (I haven't used CG* before, so this is my first try with that)

Code:
- (NSString *)imageToString:(UIImage*) oneLineImage {

	int rows = oneLineImage.size.height;
	int cols = oneLineImage.size.width;

	void* data = malloc(rows*cols*4);
	CGContextRef contextRef = CGBitmapContextCreate(data, rows, cols, 8, rows*4, nil, kCGImageAlphaFirst);
	CGImageRef cgImage = oneLineImage.CGImage;
	CGRect rect = CGRectMake(0, 0, rows, cols);
	CGContextDrawImage(contextRef, rect, cgImage);
....
	free(data);
}
Cheers

Nik
realberen is offline   Reply With Quote
 

» Advertisements
» Online Users: 580
14 members and 566 guests
chemistry, ckgni, devangvyas, Domele, hiddendemo, ilmman, linkmx, PetarPM, Prolocksmith12, savvycom, Speed, StormFactory, sudama, tonylinux
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,780
Threads: 89,204
Posts: 380,599
Top Poster: BrianSlick (7,129)
Welcome to our newest member, Prolocksmith12
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:30 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.