GPUImageContext.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #import "GLProgram.h"
  2. #import "GPUImageFramebuffer.h"
  3. #import "GPUImageFramebufferCache.h"
  4. #define GPUImageRotationSwapsWidthAndHeight(rotation) ((rotation) == kGPUImageRotateLeft || (rotation) == kGPUImageRotateRight || (rotation) == kGPUImageRotateRightFlipVertical || (rotation) == kGPUImageRotateRightFlipHorizontal)
  5. typedef enum { kGPUImageNoRotation, kGPUImageRotateLeft, kGPUImageRotateRight, kGPUImageFlipVertical, kGPUImageFlipHorizonal, kGPUImageRotateRightFlipVertical, kGPUImageRotateRightFlipHorizontal, kGPUImageRotate180 } GPUImageRotationMode;
  6. @interface GPUImageContext : NSObject
  7. @property(readonly, nonatomic) dispatch_queue_t contextQueue;
  8. @property(readwrite, retain, nonatomic) GLProgram *currentShaderProgram;
  9. @property(readonly, retain, nonatomic) EAGLContext *context;
  10. @property(readonly) CVOpenGLESTextureCacheRef coreVideoTextureCache;
  11. @property(readonly) GPUImageFramebufferCache *framebufferCache;
  12. + (void *)contextKey;
  13. + (GPUImageContext *)sharedImageProcessingContext;
  14. + (dispatch_queue_t)sharedContextQueue;
  15. + (GPUImageFramebufferCache *)sharedFramebufferCache;
  16. + (void)useImageProcessingContext;
  17. - (void)useAsCurrentContext;
  18. + (void)setActiveShaderProgram:(GLProgram *)shaderProgram;
  19. - (void)setContextShaderProgram:(GLProgram *)shaderProgram;
  20. + (GLint)maximumTextureSizeForThisDevice;
  21. + (GLint)maximumTextureUnitsForThisDevice;
  22. + (GLint)maximumVaryingVectorsForThisDevice;
  23. + (BOOL)deviceSupportsOpenGLESExtension:(NSString *)extension;
  24. + (BOOL)deviceSupportsRedTextures;
  25. + (BOOL)deviceSupportsFramebufferReads;
  26. + (CGSize)sizeThatFitsWithinATextureForSize:(CGSize)inputSize;
  27. - (void)presentBufferForDisplay;
  28. - (GLProgram *)programForVertexShaderString:(NSString *)vertexShaderString fragmentShaderString:(NSString *)fragmentShaderString;
  29. - (void)useSharegroup:(EAGLSharegroup *)sharegroup;
  30. // Manage fast texture upload
  31. + (BOOL)supportsFastTextureUpload;
  32. @end
  33. @protocol GPUImageInput <NSObject>
  34. - (void)newFrameReadyAtTime:(CMTime)frameTime atIndex:(NSInteger)textureIndex;
  35. - (void)setInputFramebuffer:(GPUImageFramebuffer *)newInputFramebuffer atIndex:(NSInteger)textureIndex;
  36. - (NSInteger)nextAvailableTextureIndex;
  37. - (void)setInputSize:(CGSize)newSize atIndex:(NSInteger)textureIndex;
  38. - (void)setInputRotation:(GPUImageRotationMode)newInputRotation atIndex:(NSInteger)textureIndex;
  39. - (CGSize)maximumOutputSize;
  40. - (void)endProcessing;
  41. - (BOOL)shouldIgnoreUpdatesToThisTarget;
  42. - (BOOL)enabled;
  43. - (BOOL)wantsMonochromeInput;
  44. - (void)setCurrentlyReceivingMonochromeInput:(BOOL)newValue;
  45. @end