相框 - iPhone [英] Picture frames - iPhone
本文介绍了相框 - iPhone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要能拍摄照片(相机或图书馆),并在其上叠加类似相框,然后将其保存回相机胶卷。我应该研究OpenGL吗?或者什么?
I'd like to be able to take a picture (camera or library) and overlay something like a picture frame on it, then save it back to the camera roll. Should I be looking into OpenGL?or, what?
感谢指针。
推荐答案
除了Quartz,你不需要任何东西。查看 CGBitmapContext
, CGContext
, CGImage
, UIImage
。还有一个功能可以在相册中存储图片: UIImageWriteToSavedPhotosAlbum
You don't need anything except Quartz for that. Look into CGBitmapContext
, CGContext
, CGImage
, UIImage
. There's also a function to store images in the album: UIImageWriteToSavedPhotosAlbum
The way to go is:
- 从
UIImagePickerController
获取UIImage
。 使用 - 在此上下文中绘制图像:
CGContextDrawImage
- 在任何你想要的地方绘制
- 使用
CGBitmapContextCreateImage
从上下文创建CGImage - 使用
[UIImage imageWithCGImage:]
c> UIImage - 使用
UIImageWriteToSavedPhotosAlbum
保存增强图片。
CGBitmapContextCreate
创建上下文。- Get a
UIImage
fromUIImagePickerController
. - Build a context using
CGBitmapContextCreate
- Draw the image in this context:
CGContextDrawImage
- Draw whatever you want on top of that
- Use
CGBitmapContextCreateImage
to create a CGImage from the context - Use
[UIImage imageWithCGImage:]
to get aUIImage
from theCGImage
- Use
UIImageWriteToSavedPhotosAlbum
to save the augmented image.
这篇关于相框 - iPhone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文