-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRamTexture.h
62 lines (49 loc) · 1.66 KB
/
RamTexture.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
60
61
62
/// @file
/// @author Kresimir Spes
/// @author Boris Mikic
/// @version 3.3
///
/// @section LICENSE
///
/// This program is free software; you can redistribute it and/or modify it under
/// the terms of the BSD license: http://www.opensource.org/licenses/bsd-license.php
///
/// @section DESCRIPTION
///
/// Defines a special RAM texture.
#ifndef APRIL_RAM_TEXTURE_H
#define APRIL_RAM_TEXTURE_H
#include <hltypes/hstring.h>
#include "aprilExport.h"
#include "Color.h"
#include "Texture.h"
namespace april
{
class Image;
class aprilExport RamTexture : public Texture
{
public:
RamTexture(chstr filename);
RamTexture(int w, int h);
~RamTexture();
bool load();
void unload();
bool isLoaded();
Color getPixel(int x, int y);
bool setPixel(int x, int y, Color color);
bool write(int sx, int sy, int sw, int sh, int dx, int dy, Texture* texture);
bool writeStretch(int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, Texture* texture);
bool blit(int sx, int sy, int sw, int sh, int dx, int dy, Texture* texture, unsigned char alpha = 255);
bool blitStretch(int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, Texture* texture, unsigned char alpha = 255);
bool insertAlphaMap(Texture* texture, unsigned char median, int ambiguity);
protected:
Image* source;
// not used
bool _createInternalTexture(unsigned char* data, int size, Type type);
void _assignFormat();
Lock _tryLockSystem(int x, int y, int w, int h);
bool _unlockSystem(Lock& lock, bool update);
bool _uploadToGpu(int sx, int sy, int sw, int sh, int dx, int dy, unsigned char* srcData, int srcWidth, int srcHeight, Image::Format srcFormat);
};
}
#endif