GPUImagePicture类静态图像处理操作,它可以是需要处理的静态图像,也可以是一张作为纹理使用的图片,调用向它发送processImage消息,进行图像滤镜处理。 方法 - (id)initWithURL:(NSURL *)url 说明:使用指定url的图片来初 ...
GPUImagePicture类静态图像处理操作,它可以是需要处理的静态图像,也可以是一张作为纹理使用的图片,调用向它发送processImage消息,进行图像滤镜处理。
方法
- (id)initWithURL:(NSURL *)url
说明:使用指定url的图片来初始化GPUImagePicture
- (id)initWithImage:(UIImage *)newImageSource
说明:使用指定的UIImage对象来初始化GPUImagePicture
- (id)initWithCGImage:(CGImageRef)newImageSource
说明:使用指定的CGImageRef对象来初始化GPUImagePicture
- (id)initWithImage:(UIImage *)newImageSource smoothlyScaleOutput:(BOOL)smoothlyScaleOutput
说明:使用指定的UIImage对象来初始化GPUImagePicture,是否按比例调整输入图像的尺寸
- (void)processImage
说明:进行图像处理实际操作。
- (BOOL)processImageWithCompletionHandler:(void (^)(void))completion
说明:进行图像处理实际的操作,completion为当处理结束执行的操作。
完整代码
#import <UIKit/UIKit.h>#import "GPUImageOutput.h"@interface GPUImagePicture : GPUImageOutput{ CGSize pixelSizeOfImage; BOOL hasProcessedImage; dispatch_semaphore_t imageUpdateSemaphore;}// Initialization and teardown- (id)initWithURL:(NSURL *)url;- (id)initWithImage:(UIImage *)newImageSource;- (id)initWithCGImage:(CGImageRef)newImageSource;- (id)initWithImage:(UIImage *)newImageSource smoothlyScaleOutput:(BOOL)smoothlyScaleOutput;- (id)initWithCGImage:(CGImageRef)newImageSource smoothlyScaleOutput:(BOOL)smoothlyScaleOutput;// Image rendering- (void)processImage;- (CGSize)outputImageSize;/** * Process image with all targets and filters asynchronously * The completion handler is called after processing finished in the * GPU's dispatch queue - and only if this method did not return NO. * * @returns NO if resource is blocked and processing is discarded, YES otherwise */- (BOOL)processImageWithCompletionHandler:(void (^)(void))completion;- (void)processImageUpToFilter:(GPUImageOutput<GPUImageInput> *)finalFilterInChain withCompletionHandler:(void (^)(UIImage *processedImage))block;@end
原标题:GPUImage API 文档之GPUImagePicture类
关键词:
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。