MythTV  master
polygon.h
Go to the documentation of this file.
1 #ifndef POLYGON_H_
2 #define POLYGON_H_
3 
4 #include <cstring>
5 
6 template<typename Pixel>
7 class Bitmap
8 {
9  public:
10  int width { 0 };
11  int height { 0 };
12  int extra;
13  Pixel *data { nullptr };
14 
15  explicit Bitmap(int e = 0) : extra(e) {}
16  ~Bitmap() { delete[] data; }
17 
18  void size(int w,int h)
19  {
20  delete[] data;
21  width = w;
22  height = h;
23  data = new Pixel[2*w*h+extra];
24  clear();
25  }
26 
27  void clear()
28  {
29  memset(data,0,sizeof (Pixel)*(2*width*height+extra));
30  }
31 };
32 #endif
Bitmap::clear
void clear()
Definition: polygon.h:27
Bitmap::Bitmap
Bitmap(int e=0)
Definition: polygon.h:15
Bitmap::size
void size(int w, int h)
Definition: polygon.h:18
Bitmap::height
int height
Definition: polygon.h:11
Bitmap::data
Pixel * data
Definition: polygon.h:13
Bitmap
Definition: polygon.h:7
Bitmap::~Bitmap
~Bitmap()
Definition: polygon.h:16
Bitmap::extra
int extra
Definition: polygon.h:12
Bitmap::width
int width
Definition: polygon.h:10