I'll set an image on a GPUImageView.
UIImage *adjustedImage = [lookupFilter imageFromCurrentFramebufferWithOrientation:0];
[self->_imgView setImage:adjustedImage];
But in the GPUImageView
Class is not the setImage:
method.
Can someone post the whole method of setImage:
or tell me how I can find this method?
I thought I can copy the method from the UIImageView.m
file and paste it in the GPUImageView.m
file. But I can't find the UIImageView.m
file.
GPUImageView.h
#import <UIKit/UIKit.h>
#import "GPUImageContext.h"
typedef enum {
kGPUImageFillModeStretch, // Stretch to fill the full view, which may distort the image outside of its normal aspect ratio
kGPUImageFillModePreserveAspectRatio, // Maintains the aspect ratio of the source image, adding bars of the specified background color
kGPUImageFillModePreserveAspectRatioAndFill // Maintains the aspect ratio of the source image, zooming in on its center to fill the view
} GPUImageFillModeType;
/**
UIView subclass to use as an endpoint for displaying GPUImage outputs
*/
@interface GPUImageView : UIView <GPUImageInput>
{
GPUImageRotationMode inputRotation;
}
/** The fill mode dictates how images are fit in the view, with the default being kGPUImageFillModePreserveAspectRatio
*/
@property(readwrite, nonatomic) GPUImageFillModeType fillMode;
/** This calculates the current display size, in pixels, taking into account Retina scaling factors
*/
@property(readonly, nonatomic) CGSize sizeInPixels;
@property(nonatomic) BOOL enabled;
/** Handling fill mode
@param redComponent Red component for background color
@param greenComponent Green component for background color
@param blueComponent Blue component for background color
@param alphaComponent Alpha component for background color
*/
- (void)setBackgroundColorRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent alpha:(GLfloat)alphaComponent;
- (void)setCurrentlyReceivingMonochromeInput:(BOOL)newValue;
@end
GPUImageView is not a subclass of UIImageView. It has no -setImage:
method. You don't set UIImages to it. It doesn't work that way.
A GPUImageView is a destination for your filter chain. To display an image within it, you set the GPUImageView as a target either of your GPUImagePicture instance or of the filters that follow from that (if you want to display the filtered output). You do not set a UIImage as the contents of that view. Again, it's not a UIImageView.
There are plenty of examples for how to use a GPUImageView with the samples that ship with GPUImage. I also explain how this works in my documentation for the project. Please review that before proceeding further.