PAGSurface Class Reference

Inherits from NSObject
Declared in PAGSurface.h

+ FromLayer:

Creates a new PAGSurface from specified CAEAGLLayer. The GPU context will be created internally by PAGSurface.

+ (PAGSurface *)FromLayer:(CAEAGLLayer *)layer

Declared In

PAGSurface.h

+ FromCVPixelBuffer:

Creates a new PAGSurface from specified CVPixelBuffer. The GPU context will be created internally by PAGSurface.

+ (PAGSurface *)FromCVPixelBuffer:(CVPixelBufferRef)pixelBuffer

Declared In

PAGSurface.h

+ FromCVPixelBuffer:context:

Creates a new PAGSurface from specified CVPixelBuffer and EAGLContext. Multiple PAGSurfaces with the same context share the same GPU caches. The caches are not destroyed when resetting a PAGPlayer’s surface to another PAGSurface with the same context.

+ (PAGSurface *)FromCVPixelBuffer:(CVPixelBufferRef)pixelBuffer context:(EAGLContext *)eaglContext

Declared In

PAGSurface.h

+ MakeFromGPU:

Deprecated Creates an offscreen PAGSurface of the specified size for pixel reading.

+ (PAGSurface *)MakeFromGPU:(CGSize)size

Declared In

PAGSurface.h

+ MakeOffscreen:

Creates an offscreen PAGSurface of the specified size for pixel reading.

+ (PAGSurface *)MakeOffscreen:(CGSize)size

Declared In

PAGSurface.h

– width

The width of surface in pixels.

- (int)width

Declared In

PAGSurface.h

– height

The height of the surface in pixels.

- (int)height

Declared In

PAGSurface.h

– updateSize

Update the size of the surface, and reset the internal surface.

- (void)updateSize

Declared In

PAGSurface.h

– clearAll

Erases all pixels of this surface with transparent color. Returns true if the content has changed.

- (BOOL)clearAll

Declared In

PAGSurface.h

– freeCache

Free the cache created by the surface immediately. Can be called to reduce memory pressure.

- (void)freeCache

Declared In

PAGSurface.h

– getCVPixelBuffer

Returns the internal CVPixelBuffer object associated with this PAGSurface, returns nil if the PAGSurface is created by [PAGSurface FromLayer], or the app is running in the simulator.

- (CVPixelBufferRef)getCVPixelBuffer

Declared In

PAGSurface.h

– makeSnapshot

Returns a CVPixelBuffer object capturing the contents of the PAGSurface. Subsequent rendering of the PAGSurface will not be captured.

- (CVPixelBufferRef)makeSnapshot

Declared In

PAGSurface.h

– copyPixelsTo:rowBytes:

Copies the pixels of the PAGSurface to the specified memory address. The format of the copied pixels is in the BGRA color type with the premultiplied alpha type. Returns false if failed.

- (BOOL)copyPixelsTo:(void *)pixels rowBytes:(size_t)rowBytes

Declared In

PAGSurface.h