#import <CCTexture2D.h>
Public Member Functions | |
| (id) | - initWithData:pixelFormat:pixelsWide:pixelsHigh:contentSize: |
| (void) | - drawAtPoint: |
| (void) | - drawInRect: |
| (void) | - setTexParameters: |
| (void) | - setAntiAliasTexParameters |
| (void) | - setAliasTexParameters |
| (void) | - generateMipmap |
| (id) | - initWithImage: |
| (id) | - initWithPVRTCData:level:bpp:hasAlpha:length: |
| (id) | - initWithPVRTCFile: |
| (id) | - initWithString:dimensions:alignment:fontName:fontSize: |
| (id) | - initWithString:fontName:fontSize: |
Static Public Member Functions | |
| (void) | + setDefaultAlphaPixelFormat: |
| (CCTexture2DPixelFormat) | + defaultAlphaPixelFormat |
Properties | |
| CCTexture2DPixelFormat | pixelFormat |
| NSUInteger | pixelsWide |
| NSUInteger | pixelsHigh |
| GLuint | name |
| CGSize | contentSize |
| GLfloat | maxS |
| GLfloat | maxT |
| BOOL | hasPremultipliedAlpha |
CCTexture2D class. This class allows to easily create OpenGL 2D textures from images, text or raw data. The created CCTexture2D object will always have power-of-two dimensions. Depending on how you create the CCTexture2D object, the actual image area of the texture might be smaller than the texture dimensions i.e. "contentSize" != (pixelsWide, pixelsHigh) and (maxS, maxT) != (1.0, 1.0). Be aware that the content of the generated textures will be upside-down!
Definition at line 106 of file CCTexture2D.h.
| + (CCTexture2DPixelFormat) defaultAlphaPixelFormat |
returns the alpha pixel format
| - (void) drawAtPoint: | (CGPoint) | point |
draws a texture at a given point
| - (void) drawInRect: | (CGRect) | rect |
draws a texture inside a rect
| - (void) generateMipmap |
Generates mipmap images for the texture. It only works if the texture size is POT (power of 2).
| - (id) initWithData: | (const void *) | data | ||
| pixelFormat: | (CCTexture2DPixelFormat) | pixelFormat | ||
| pixelsWide: | (NSUInteger) | width | ||
| pixelsHigh: | (NSUInteger) | height | ||
| contentSize: | (CGSize) | size | ||
Intializes with a texture2d with data
| - (id) initWithImage: | (UIImage *) | uiImage |
Initializes a texture from a UIImage object
| - (id) initWithPVRTCData: | (const void *) | data | ||
| level: | (int) | level | ||
| bpp: | (int) | bpp | ||
| hasAlpha: | (BOOL) | hasAlpha | ||
| length: | (int) | length | ||
Initializes a texture from a PVRTC buffer
| - (id) initWithPVRTCFile: | (NSString *) | file |
Initializes a texture from a PVRTC file
| - (id) initWithString: | (NSString *) | string | ||
| dimensions: | (CGSize) | dimensions | ||
| alignment: | (UITextAlignment) | alignment | ||
| fontName: | (NSString *) | name | ||
| fontSize: | (CGFloat) | size | ||
Initializes a texture from a string with dimensions, alignment, font name and font size
| - (id) initWithString: | (NSString *) | string | ||
| fontName: | (NSString *) | name | ||
| fontSize: | (CGFloat) | size | ||
Initializes a texture from a string with font name and font size
| - (void) setAliasTexParameters |
sets alias texture parameters:
| - (void) setAntiAliasTexParameters |
sets antialias texture parameters:
| + (void) setDefaultAlphaPixelFormat: | (CCTexture2DPixelFormat) | format |
sets the default pixel format for UIImages that contains alpha channel. If the UIImage contains alpha channel, then the options are:
How does it work ?
| - (void) setTexParameters: | (ccTexParams *) | texParams |
sets the min filter, mag filter, wrap s and wrap t texture parameters. If the texture size is NPOT (non power of 2), then in can only use GL_CLAMP_TO_EDGE in GL_TEXTURE_WRAP_{S,T}.
- (CGSize) contentSize [read, assign] |
content size
Definition at line 131 of file CCTexture2D.h.
- (BOOL) hasPremultipliedAlpha [read, assign] |
whether or not the texture has their Alpha premultiplied
Definition at line 137 of file CCTexture2D.h.
- (GLfloat) maxS [read, write, assign] |
texture max S
Definition at line 133 of file CCTexture2D.h.
- (GLfloat) maxT [read, write, assign] |
texture max T
Definition at line 135 of file CCTexture2D.h.
- (GLuint) name [read, assign] |
texture name
Definition at line 128 of file CCTexture2D.h.
- (CCTexture2DPixelFormat) pixelFormat [read, assign] |
pixel format of the texture
Definition at line 121 of file CCTexture2D.h.
- (NSUInteger) pixelsHigh [read, assign] |
hight in pixels
Definition at line 125 of file CCTexture2D.h.
- (NSUInteger) pixelsWide [read, assign] |
width in pixels
Definition at line 123 of file CCTexture2D.h.