le3d - LightEngine 3D
A straightforward C++ 3D software engine for real-time graphics
bitmap.h
Go to the documentation of this file.
1 
33 #ifndef LE_BITMAP_H
34 #define LE_BITMAP_H
35 
36 #include "global.h"
37 #include "color.h"
38 #include "config.h"
39 
40 /*****************************************************************************/
45 typedef enum {
50 
51 /*****************************************************************************/
52 class LeBmpFont;
53 
58 class LeBitmap
59 {
60 public:
61  LeBitmap();
62  ~LeBitmap();
63 
64  void clear(LeColor color);
65  void rect(int32_t x, int32_t y, int32_t w, int32_t h, LeColor color);
66  void blit(int32_t xDst, int32_t yDst, const LeBitmap * src, int32_t xSrc, int32_t ySrc, int32_t w, int32_t h);
67  void alphaBlit(int32_t xDst, int32_t yDst, const LeBitmap * src, int32_t xSrc, int32_t ySrc, int32_t w, int32_t h);
68  void alphaScaleBlit(int32_t xDst, int32_t yDst, int32_t wDst, int32_t hDst, const LeBitmap * src, int32_t xSrc, int32_t ySrc, int32_t wSrc, int32_t hSrc);
69 
70  void text(int x, int y, const char * text, int length, const LeBmpFont * font);
71 
72  void allocate(int tx, int ty);
73  void deallocate();
74 
75  void preMultiply();
76  void makeMipmaps();
77 
81  int tx;
82  int ty;
83  int txP2;
84  int tyP2;
85  int flags;
87  void * data;
91  int mmLevels;
92 };
93 
94 /*****************************************************************************/
99 class LeBmpFont
100 {
101 public:
102  LeBmpFont();
103  ~LeBmpFont();
104 
107  int charSizeX;
108  int charSizeY;
109  int charBegin;
110  int charEnd;
111  int spaceX;
112  int spaceY;
113 };
114 
115 #endif // LE_BITMAP_H
116 
~LeBmpFont()
Definition: bitmap.cpp:68
int tyP2
Definition: bitmap.h:84
int flags
Definition: bitmap.h:85
LE_BITMAP_FLAGS
Bitmap format flags.
Definition: bitmap.h:45
void text(int x, int y, const char *text, int length, const LeBmpFont *font)
Write a short text with the specified bitmap character set.
Definition: bitmap.cpp:467
void alphaScaleBlit(int32_t xDst, int32_t yDst, int32_t wDst, int32_t hDst, const LeBitmap *src, int32_t xSrc, int32_t ySrc, int32_t wSrc, int32_t hSrc)
Copy and scale an image portion to the image (premultiplied alpha format)
Definition: bitmap.cpp:398
int charEnd
Definition: bitmap.h:110
Definition: bitmap.h:46
void allocate(int tx, int ty)
Allocate bitmap memory.
Definition: bitmap.cpp:495
int tx
Definition: bitmap.h:81
Contain and manage a monospace bitmap font.
Definition: bitmap.h:99
LightEngine 3D: General engine configuration file.
LeBitmap * mipmaps[LE_BMP_MIPMAPS]
Definition: bitmap.h:90
Definition: bitmap.h:48
LightEngine 3D: Global helpers and definitions.
void deallocate()
Deallocate bitmap memory.
Definition: bitmap.cpp:516
LeBmpFont()
Definition: bitmap.cpp:60
void blit(int32_t xDst, int32_t yDst, const LeBitmap *src, int32_t xSrc, int32_t ySrc, int32_t w, int32_t h)
Copy an image portion to the image.
Definition: bitmap.cpp:163
bool dataAllocated
Definition: bitmap.h:88
int spaceY
Definition: bitmap.h:112
int charBegin
Definition: bitmap.h:109
#define LE_BMP_MIPMAPS
Definition: config.h:56
~LeBitmap()
Definition: bitmap.cpp:54
void * data
Definition: bitmap.h:87
LeHandle context
Definition: bitmap.h:78
void clear(LeColor color)
Clear the image with the specified color.
Definition: bitmap.cpp:105
int ty
Definition: bitmap.h:82
LeHandle bitmap
Definition: bitmap.h:79
Contain and manage a RGB or RGBA 32bit bitmap image.
Definition: bitmap.h:58
Represent an RGBA color.
Definition: color.h:42
unsigned long long LeHandle
Definition: global.h:41
Definition: bitmap.h:47
void alphaBlit(int32_t xDst, int32_t yDst, const LeBitmap *src, int32_t xSrc, int32_t ySrc, int32_t w, int32_t h)
Copy an image portion to the image (premultiplied alpha format)
Definition: bitmap.cpp:269
LightEngine 3D: Color implementation.
void rect(int32_t x, int32_t y, int32_t w, int32_t h, LeColor color)
Fill a rectangle with the specified color.
Definition: bitmap.cpp:124
int charSizeX
Definition: bitmap.h:107
LeBitmap()
Definition: bitmap.cpp:42
int mmLevels
Definition: bitmap.h:91
int txP2
Definition: bitmap.h:83
void preMultiply()
Alpha pre-multiply an RGBA bitmap.
Definition: bitmap.cpp:535
int spaceX
Definition: bitmap.h:111
int charSizeY
Definition: bitmap.h:108
LeBitmap * font
Definition: bitmap.h:105
void makeMipmaps()
Generate mipmaps from the bitmap.
Definition: bitmap.cpp:556