Menu

[r4622]: / branches / transforms / swig / agg_buffer.h  Maximize  Restore  History

Download this file

50 lines (36 with data), 875 Bytes

 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
/* agg_buffer.h -- John D. Hunter
*/
#ifndef _AGG_BUFFER_H
#define _AGG_BUFFER_H
#include <iostream>
#include "agg_basics.h"
namespace agg {
typedef struct binary_data {
int size;
unsigned char* data;
} binary_data;
struct buffer {
public:
buffer(unsigned width, unsigned height, unsigned stride, bool freemem=true) :
width(width), height(height), stride(stride), freemem(freemem) {
data = new int8u[height*stride];
}
~buffer() {
//std::cout << "bye bye " << freemem << std::endl;
if (freemem) {
delete [] data;
data = NULL;
}
}
binary_data to_string() {
binary_data result;
result.size = height*stride;
result.data = data;
return result;
}
const unsigned width, height, stride;
int8u *data;
bool freemem;
};
}
#endif
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.