|
cocos2d-iphone
2.1
Improved Cocos2D API Reference (iOS version) for www.koboldtouch.com developers
|
#import <CCTexture2D.h>
Instance Methods | |
| (id) | - initWithData:pixelFormat:pixelsWide:pixelsHigh:contentSize: |
| (void) | - releaseData: |
| (void *) | - keepData:length: |
| (CGSize) | - contentSize |
| (id) | - initWithString:dimensions:alignment:lineBreakMode:fontName:fontSize: |
| (id) | - initWithString:dimensions:alignment:fontName:fontSize: |
| (void) | - drawAtPoint: |
| (void) | - drawInRect: |
| (void) | - setTexParameters: |
| (void) | - setAntiAliasTexParameters |
| (void) | - setAliasTexParameters |
| (void) | - generateMipmap |
| (id) | - initWithCGImage:resolutionType: |
| (NSUInteger) | - bitsPerPixelForFormat |
| (NSString *) | - stringForFormat |
| (id) | - initWithPVRFile: |
| (id) | - initWithString:fontName:fontSize:dimensions:hAlignment:vAlignment:lineBreakMode: |
| (id) | - initWithString:fontName:fontSize:dimensions:hAlignment:vAlignment: |
| (id) | - initWithString:fontName:fontSize: |
Class Methods | |
| (void) | + setDefaultAlphaPixelFormat: |
| (CCTexture2DPixelFormat) | + defaultAlphaPixelFormat |
| (NSUInteger) | + bitsPerPixelForFormat: |
| (void) | + PVRImagesHavePremultipliedAlpha: |
Protected Attributes | |
| GLuint | _name |
| CGSize | _size |
| NSUInteger | _width |
| NSUInteger | _height |
| CCTexture2DPixelFormat | _format |
| GLfloat | _maxS |
| GLfloat | _maxT |
| BOOL | _hasPremultipliedAlpha |
| BOOL | _hasMipmaps |
| ccResolutionType | _resolutionType |
| CCGLProgram * | _shaderProgram |
Properties | |
| CCTexture2DPixelFormat | pixelFormat |
| NSUInteger | pixelsWide |
| NSUInteger | pixelsHigh |
| GLuint | name |
| CGSize | contentSizeInPixels |
| GLfloat | maxS |
| GLfloat | maxT |
| BOOL | hasPremultipliedAlpha |
| CCGLProgram * | shaderProgram |
| ccResolutionType | resolutionType |
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!
| - (NSUInteger) bitsPerPixelForFormat |
returns the bits-per-pixel of the in-memory OpenGL texture
Provided by category CCTexture2D(PixelFormat).
| + (NSUInteger) bitsPerPixelForFormat: | (CCTexture2DPixelFormat) | format |
Helper functions that returns bits per pixels for a given format.
Provided by category CCTexture2D(PixelFormat).
| - (CGSize) contentSize |
returns the content size of the texture in points
| + (CCTexture2DPixelFormat) defaultAlphaPixelFormat |
| - (void) drawAtPoint: | (CGPoint) | point |
draws a texture at a given point
Provided by category CCTexture2D(Drawing).
| - (void) drawInRect: | (CGRect) | rect |
draws a texture inside a rect
Provided by category CCTexture2D(Drawing).
| - (void) generateMipmap |
Generates mipmap images for the texture. It only works if the texture size is POT (power of 2).
Provided by category CCTexture2D(GLFilter).
| - (id) initWithCGImage: | (CGImageRef) | cgImage | |
| resolutionType: | (ccResolutionType) | resolution | |
Initializes a texture from a CGImage object
Provided by category CCTexture2D(Image).
| - (id) initWithData: | (const void *) | data | |
| pixelFormat: | (CCTexture2DPixelFormat) | pixelFormat | |
| pixelsWide: | (NSUInteger) | width | |
| pixelsHigh: | (NSUInteger) | height | |
| contentSize: | (CGSize) | size | |
Initializes with a texture2d with data
| - (id) initWithPVRFile: | (NSString *) | file |
Initializes a texture from a PVR file.
Supported PVR formats:
By default PVR images are treated as if they alpha channel is NOT premultiplied. You can override this behavior with this class method:
IMPORTANT: This method is only defined on iOS. It is not supported on the Mac version.
Provided by category CCTexture2D(PVRSupport).
| - (id) initWithString: | (NSString *) | string | |
| fontName: | (NSString *) | name | |
| fontSize: | (CGFloat) | size | |
Initializes a texture from a string with font name and font size
Provided by category CCTexture2D(Text).
| - (id) initWithString: | (NSString *) | string | |
| fontName: | (NSString *) | name | |
| fontSize: | (CGFloat) | size | |
| dimensions: | (CGSize) | dimensions | |
| hAlignment: | (CCTextAlignment) | alignment | |
| vAlignment: | (CCVerticalTextAlignment) | vertAlignment | |
Initializes a texture from a string with dimensions, alignment, font name and font size
Provided by category CCTexture2D(Text).
| - (id) initWithString: | (NSString *) | string | |
| fontName: | (NSString *) | name | |
| fontSize: | (CGFloat) | size | |
| dimensions: | (CGSize) | dimensions | |
| hAlignment: | (CCTextAlignment) | alignment | |
| vAlignment: | (CCVerticalTextAlignment) | vertAlignment | |
| lineBreakMode: | (CCLineBreakMode) | lineBreakMode | |
Initializes a texture from a string with dimensions, alignment, line break mode, font name and font size Supported lineBreakModes:
Provided by category CCTexture2D(Text).
| + (void) PVRImagesHavePremultipliedAlpha: | (BOOL) | haveAlphaPremultiplied |
treats (or not) PVR files as if they have alpha premultiplied. Since it is impossible to know at runtime if the PVR images have the alpha channel premultiplied, it is possible load them as if they have (or not) the alpha channel premultiplied.
By default it is disabled.
Provided by category CCTexture2D(PVRSupport).
| - (void) releaseData: | (void *) | data |
These functions are needed to create mutable textures
| - (void) setAliasTexParameters |
sets alias texture parameters:
Provided by category CCTexture2D(GLFilter).
| - (void) setAntiAliasTexParameters |
sets antialias texture parameters:
Provided by category CCTexture2D(GLFilter).
| + (void) setDefaultAlphaPixelFormat: | (CCTexture2DPixelFormat) | format |
sets the default pixel format for CGImages that contains alpha channel. If the CGImage contains alpha channel, then the options are:
How does it work ?
This parameter is not valid for PVR / PVR.CCZ images.
Provided by category CCTexture2D(PixelFormat).
| - (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}.
Provided by category CCTexture2D(GLFilter).
| - (NSString*) stringForFormat |
|
readnonatomicassign |
returns content size of the texture in pixels
|
readnonatomicassign |
whether or not the texture has their Alpha premultiplied
|
readwritenonatomicassign |
texture max S
|
readwritenonatomicassign |
texture max T
|
readnonatomicassign |
texture name
|
readnonatomicassign |
pixel format of the texture
|
readnonatomicassign |
hight in pixels
|
readnonatomicassign |
width in pixels
|
readwritenonatomicassign |
Returns the resolution type of the texture. Is it a RetinaDisplay texture, an iPad texture, a Mac, a Mac RetinaDisplay or an standard texture ?
Should be a readonly property. It is readwrite as a hack.
|
readwritenonatomicretain |
shader program used by drawAtPoint and drawInRect