我将在 GPUImageView 上设置图像。
UIImage *adjustedImage = [lookupFilter imageFromCurrentFramebufferWithOrientation:0];
[self->_imgView setImage:adjustedImage];
但是在GPUImageView
类中是没有setImage:
方法的。
有人可以发布 setImage:
的整个方法或者告诉我如何找到这个方法吗?
我想我可以从 UIImageView.m
文件中复制方法并将其粘贴到 GPUImageView.m
文件中。但是我找不到 UIImageView.m
文件。
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 不是 UIImageView 的子类。它没有 -setImage:
方法。您没有为其设置 UIImages 。它不是那样工作的。
GPUImageView 是您的过滤器链的目的地。要在其中显示图像,您可以将 GPUImageView 设置为您的 GPUImagePicture 实例或后续过滤器的目标(如果您想要显示过滤后的输出)。您没有将 UIImage 设置为该 View 的内容。同样,它不是 UIImageView。
有很多示例说明如何将 GPUImageView 与 GPUImage 附带的示例一起使用。我还在我的项目文档中解释了这是如何工作的。请在继续之前检查一下。
关于ios - 在 GPUImageView 上找不到方法 "setImage:",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23712718/