NetBurner 3.5.8
PDF Version
Toggle main menu visibility
Web/GifCanvas/src/drawimage.h
1
/*NB_REVISION*/
2
3
/*NB_COPYRIGHT*/
4
5
/* This file contains a simple class for drawing Graphics into a GIF image */
6
7
#ifndef _DRAWIMAGE_H_
8
#define _DRAWIMAGE_H_
9
10
#include <basictypes.h>
11
12
#include "gifCompress.h"
13
14
class
GitCompress;
15
16
class
DrawImageObject
17
{
18
uint8_t *m_pImageBuffer =
nullptr
;
19
uint8_t *m_pColorArray =
nullptr
;
20
21
int
m_xSize = 0;
22
int
m_ySize = 0;
23
int
m_nColors = 0;
24
25
int
m_curx = 0;
26
int
m_cury = 0;
27
28
bool
m_trans =
false
;
29
uint8_t m_transIndex = 0;
30
31
GitCompress m_gitCompress;
32
33
friend
class
GitCompress;
34
35
private
:
36
int
GIFNextPixel();
37
void
compress(
int
init_bits,
int
fd);
38
39
public
:
40
/* You must specify the size and color depth of the GIF object in the constructor */
41
DrawImageObject(
int
x,
int
y,
int
ncolors,
bool
transparent, uint8_t transIndex);
42
~DrawImageObject();
43
44
/* Set a specific pixel to a specific color */
45
void
PutPixel(
int
x,
int
y, uint8_t color);
46
47
/* Get the color of a specific pixel */
48
uint8_t GetPixel(
int
x,
int
y);
49
50
/* All colors are index based. You must define the color for each index */
51
void
SetColor(uint8_t index, uint8_t red, uint8_t green, uint8_t blue);
52
53
/* Draw a line */
54
void
Line(
int
x1,
int
y1,
int
x2,
int
y2, uint8_t colorindex);
55
56
/* Draw a box */
57
void
Box(
int
x1,
int
y1,
int
x2,
int
y2, uint8_t colorindex);
58
59
/* Draw a filled box */
60
void
FilledBox(
int
x1,
int
y1,
int
x2,
int
y2, uint8_t fillc, uint8_t outlinec);
61
62
/* Draw text */
63
void
Text(
const
char
*pText,
int
x1,
int
x2,
const
char
*fontrecord, uint8_t color);
64
int
TextXsize(
const
char
*pText,
const
char
*fontrecord);
65
int
TextYsize(
const
char
*pText,
const
char
*fontrecord);
66
67
/* After you have done all of your drawing you must call this function to send the GIF */
68
void
WriteGIF(
int
fd);
69
};
70
71
extern
const
char
GiantFont[];
72
extern
const
char
LargeFont[];
73
extern
const
char
MediumFont[];
74
extern
const
char
SmallFont[];
75
extern
const
char
TinyFont[];
76
77
#endif
/* _DRAWIMAGE_H_ */
examples
Web
GifCanvas
src
drawimage.h
Generated by
1.18.0