-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImgBuffer.h
More file actions
60 lines (51 loc) · 1.98 KB
/
Copy pathImgBuffer.h
File metadata and controls
60 lines (51 loc) · 1.98 KB
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
50
51
52
53
54
55
56
57
58
59
60
///////////////////////////////////////////////////////////////////////////////
// MODULE: ImgBuffer.h
// SYSTEM: ImageBase subsystem
// AUTHOR: Nenad Amodaj, nenad@amodaj.com
//
// DESCRIPTION: Basic implementation for the raw image buffer data structure.
//
// COPYRIGHT: Nenad Amodaj, 2005. All rights reserved.
//
// LICENSE: This file is free for use, modification and distribution and
// is distributed under terms specified in the BSD license
// This file is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES.
//
// NOTE: Imported from ADVI for use in Micro-Manager
#pragma once
#include <string>
class ImgBuffer
{
public:
ImgBuffer(unsigned xSize, unsigned ySize, unsigned pixDepth);
ImgBuffer(const ImgBuffer& ib);
ImgBuffer();
~ImgBuffer();
unsigned int Width() const {return width_;}
unsigned int Height() const {return height_;}
unsigned int Depth() const {return pixDepth_;}
void SetPixels(const void* pixArray);
void SetPixelsPadded(const void* pixArray, int paddingBytesPerLine);
void ResetPixels();
const unsigned char* GetPixels() const;
unsigned char* GetPixelsRW();
void Resize(unsigned xSize, unsigned ySize, unsigned pixDepth);
void Resize(unsigned xSize, unsigned ySize);
bool Compatible(const ImgBuffer& img) const;
void SetName(const char* name) {name_ = name;}
const std::string& GetName() {return name_;}
void Copy(const ImgBuffer& rhs);
ImgBuffer& operator=(const ImgBuffer& rhs);
private:
unsigned char* pixels_;
unsigned int width_;
unsigned int height_;
unsigned int pixDepth_;
std::string name_;
};