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 03-22-2009, 01:53 AM   #3 (permalink)
bhearn
New Member
 
Join Date: Aug 2008
Posts: 125
Default

Thanks, but I'm not updating the UI; I'm resizing an image into an offscreen bitmap. Also, it takes too long to do the resize (~2 seconds) to run on the main thread; it's unacceptable to shut the interface down that long.

However, I think I have mostly solved the problem. It looks to me like you can do this safely in a background thread as long as you use only Core Graphics calls, and not the UI calls. UIGraphicsBeginImageContext() does indeed push a new CG context onto a stack, which is a problem.

But by explicitly calling CGBitmapContextCreate(), CGContextDrawImage(), and CGBitmapContextCreateImage(), you can resize the image without messing with the UIKit's graphics context stack.

The problem now is dealing with the damn imageOrientation field of the image, which seems to be handled automatically when you use the UIKit.

Also it took me a while to realize that if I wanted to get meaningful values in this field for images taken from the camera in-app, I had to first enable device orientation notifications.
bhearn is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,843
Threads: 89,211
Posts: 380,652
Top Poster: BrianSlick (7,129)
Welcome to our newest member, nataliekendal
Powered by vBadvanced CMPS v3.1.0

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