/
CCTexture2DMutable.h
59 lines (47 loc) · 1.28 KB
/
CCTexture2DMutable.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//
// CCMutableTexture.m
// Created by Lam Hoang Pham.
// Improved by Manuel Martinez-Almeida.
//
#import "CCTexture2D.h"
#import "ccTypes.h"
#define CC_MUTABLE_TEXTURE_SAVE_ORIGINAL_DATA 0
@interface CCTexture2DMutable : CCTexture2D
{
#if CC_MUTABLE_TEXTURE_SAVE_ORIGINAL_DATA
void *originalData_;
#endif
void *data_;
NSUInteger bytesPerPixel_;
bool dirty_;
}
#if CC_MUTABLE_TEXTURE_SAVE_ORIGINAL_DATA
@property(nonatomic, readonly) void *originalTexData;
#endif
@property(nonatomic, readwrite) void *texData;
- (ccColor4B) pixelAt:(CGPoint) pt;
///
// @param pt is a point to get a pixel (0,0) is top-left to (width,height) bottom-right
// @param c is a ccColor4B which is a colour.
// @returns if a pixel was set
// Remember to call apply to actually update the texture canvas.
///
- (BOOL) setPixelAt:(CGPoint) pt rgba:(ccColor4B) c;
///
// Fill with specified colour
///
- (void) fill:(ccColor4B) c;
///
// @param textureToCopy is the texture image to copy over
// @param offset also offset's the texture image
///
- (id) copyMutable:(BOOL)isMutable;
- (id) copy;
- (void) copy:(CCTexture2DMutable*)textureToCopy offset:(CGPoint) offset;
///
// apply actually updates the texture with any new data we added.
///
- (void) apply;
@end
@interface CCMutableTexture2D : CCTexture2DMutable
@end