#import <CC3Texture.h>
Instance Methods | |
(void) | - deleteImageData |
(void) | - flipHorizontally |
(void) | - flipVertically |
(id) | - initFromCC3Texture: |
(id) | - initFromFile: |
(id) | - initWithCGImage: |
(id) | - initWithSize:andPixelFormat:andPixelType: |
(id) | - initWithSize:withColor: |
(id) | - initWithSize:withPixelFormat:withPixelType: |
(void) | - resizeTo: |
(void) | - rotateHalfCircle |
Class Methods | |
(id) | + textureFromCC3Texture: |
(id) | + textureWithSize:withColor: |
A CCTexture subclass used by the CC3Texture class cluster during the loading of a 2D texture, and when extracting a CCTexture from the CC3Texture ccTexture property.
PVR texture files cannot be loaded using this class.
- (void) deleteImageData |
Deletes the texture content from main memory.
This should be invoked once the texture is bound to the GL engine.
- (void) flipHorizontally |
Flips this texture horizontally.
- (void) flipVertically |
Flips this texture vertically, to compensate for the opposite orientation of vertical graphical coordinates between OpenGL and iOS & OSX.
The value of the isUpsideDown property is toggled after flipping.
- (id) initFromCC3Texture: | (CC3Texture *) | texture |
Initializes this instance to represent the same GL texture as the specified CC3Texture.
- (id) initFromFile: | (NSString *) | filePath |
Initializes this instance with content loaded from the specified file.
The specified file path may be either an absolute path, or a path relative to the application resource directory. If the file is located directly in the application resources directory, the specified file path can simply be the name of the file.
Returns nil if the file could not be loaded.
The value of the isUpsideDown is set to YES.
- (id) initWithCGImage: | (CGImageRef) | cgImg |
Initializes this instance from the content in the specified CGImage.
The value of the isUpsideDown is set to YES.
- (id) initWithSize: | (CC3IntSize) | size | |
andPixelFormat: | (GLenum) | format | |
andPixelType: | (GLenum) | __deprecated | |
- (id) initWithSize: | (CC3IntSize) | size | |
withColor: | (ccColor4B) | color | |
Initializes this instance containing pixel content of the specified size and solid, uniform color.
This method is useful for creating a blank tetxure canvas of a particular size and color. By accessing the imageData property, the application can then draw pixels to this canvas.
- (id) initWithSize: | (CC3IntSize) | size | |
withPixelFormat: | (GLenum) | format | |
withPixelType: | (GLenum) | type | |
Initializes this instance to define the properties of a texture, without defining any specific content.
This instance can be used to initialize an empty CC3Texture, to which content can be added later.
The value of the isUpsideDown is set to NO.
- (void) resizeTo: | (CC3IntSize) | size |
Resizes this texture to the specified dimensions.
This method changes the values of the size, width, height, maxS & maxT properties, but does not make any changes to the texture within the GL engine. This method is invoked during the resizing of a texture that backs a surface.
- (void) rotateHalfCircle |
Rotates the image by 180 degrees.
This is equivalent to combined vertical and horizontal flips, but is executed in one pass for efficiency.
The value of the isUpsideDown property is toggled after rotating.
+ (id) textureFromCC3Texture: | (CC3Texture *) | texture |
Allocates and initializes an instance to represent the same GL texture as the specified CC3Texture.
+ (id) textureWithSize: | (CC3IntSize) | size | |
withColor: | (ccColor4B) | color | |
Allocates and initializes an autoreleased instance containing pixel content of the specified size and solid, uniform color.
This method is useful for creating a blank tetxure canvas of a particular size and color. By accessing the imageData property, the application can then draw pixels to this canvas.