MythTV master
polygon.h
Go to the documentation of this file.
1#ifndef POLYGON_H_
2#define POLYGON_H_
3
4#include <cstring>
5
6template<typename Pixel>
7class 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
Definition: polygon.h:8
int height
Definition: polygon.h:11
void size(int w, int h)
Definition: polygon.h:18
void clear()
Definition: polygon.h:27
int extra
Definition: polygon.h:12
int width
Definition: polygon.h:10
Pixel * data
Definition: polygon.h:13
~Bitmap()
Definition: polygon.h:16
Bitmap(int e=0)
Definition: polygon.h:15