17#import <Foundation/Foundation.h>
18#import <OpenGLES/gltypes.h>
19#import <UIKit/UIKit.h>
21NS_ASSUME_NONNULL_BEGIN
53+ (CGRect)scaledRect:(CGRect)rect scale:(
double)scale anchor:(CGPoint)anchor;
76- (void)setData:(nullable const
void *)data
78 pixelSize:(GLuint)pixelSize
89- (void)setData:(nullable const
void *)data
91 pixelSize:(GLuint)pixelSize;
103- (instancetype)initWithData:(nullable const
void *)data
105 pixelSize:(GLuint)pixelSize
117- (instancetype)initWithData:(nullable const
void *)data
119 pixelSize:(GLuint)pixelSize;
133- (instancetype)initWithImage:(nullable UIImage *)image;
145- (void)setSubImage:(nullable UIImage *)image inRect:(CGRect)rect;
153- (void)setSubImage:(nullable UIImage *)image atPoint:(CGPoint)point;
165- (void)drawAtPoint:(CGPoint)point scale:(
double)scale;
176- (void)drawInRect:(CGRect)rect
177 fromRegion:(CGRect)region
178 transform:(
char)transform
179 color:(nullable UIColor *)color;
190- (void)drawInRect:(CGRect)rect
191 fromRegion:(CGRect)region
192 transform:(
char)transform
211- (void)drawSprite:(NSUInteger)sprite
212 atPoint:(CGPoint)point
215 anchor:(CGPoint)anchor
216 transform:(
char)transform
231- (void)drawSprite:(NSUInteger)sprite
232 atPoint:(CGPoint)point
233 transform:(
char)transform
244- (void)drawSprite:(NSUInteger)sprite
246 transform:(
char)transform
255- (void)drawSprite:(NSUInteger)sprite atPoint:(CGPoint)point;
264- (void)drawSprite:(NSUInteger)sprite inRect:(CGRect)rect color:(nullable UIColor *)color;
272- (void)drawSprite:(NSUInteger)sprite inRect:(CGRect)rect;
299- (void)setSprites:(nullable NSArray<NSArray<NSNumber *> *> *)sprites;
307- (CGRect)spriteAtIndex:(
unsigned int)index;
317- (void)setClipRect:(CGRect)rect;
329@property(nonatomic, readonly) GLuint
name;
335@property(nonatomic, readonly) NSUInteger
width;
341@property(nonatomic, readonly) NSUInteger
height;
Texture2DPixelFormat
The internal storage format of a texture, chosen when its pixels are uploaded.
Definition Texture2D.h:30
@ Texture2DPixelFormatRGB888
Three bytes per pixel, uploaded as GL_RGB .
Definition Texture2D.h:32
@ Texture2DPixelFormatRGBA8888
Four bytes per pixel, uploaded as GL_RGBA .
Definition Texture2D.h:31
@ Texture2DPixelFormatA8
One byte per pixel, uploaded as GL_ALPHA .
Definition Texture2D.h:33
A texture that can draw any of the sprites packed into it.
Definition Texture2D.h:40
BOOL isScale2x
Whether packed sprites are treated as 2x-supersampled and drawn at half size.
Definition Texture2D.h:323
void resetDrawBuffer()
Discards every batched quad without drawing.
Definition Texture2D.mm:725
void commitDraw()
Flushes every batched quad in one glDrawElements , honouring the clip rectangle.
Definition Texture2D.mm:697
instancetype init()
Initialises an empty texture with no GL name and a null clip rectangle.
Definition Texture2D.mm:62
NSUInteger height
The content height in texels.
Definition Texture2D.h:341
NSUInteger width
The content width in texels.
Definition Texture2D.h:335
GLuint name
The GL texture name, or 0 when no data has been uploaded.
Definition Texture2D.h:329