forked from arduino-libraries/ArduinoGraphics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImage.cpp
60 lines (48 loc) · 990 Bytes
/
Image.cpp
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
/*
This file is part of the ArduinoGraphics library.
Copyright (c) 2025 Arduino SA. All rights reserved.
*/
#include <stddef.h>
#include "Image.h"
Image::Image() :
Image(ENCODING_NONE, (const uint8_t*)NULL, 0, 0)
{
}
Image::Image(int encoding, const uint8_t* data, int width, int height) :
_encoding(encoding),
_data(data),
_width(width),
_height(height)
{
}
Image::Image(int encoding, const uint16_t* data, int width, int height) :
Image(encoding, (const uint8_t*)data, width, height)
{
}
Image::Image(int encoding, const uint32_t* data, int width, int height) :
Image(encoding, (const uint8_t*)data, width, height)
{
}
Image::~Image()
{
}
int Image::encoding() const
{
return _encoding;
}
const uint8_t* Image::data() const
{
return _data;
}
int Image::width() const
{
return _width;
}
int Image::height() const
{
return _height;
}
Image::operator bool() const
{
return (_encoding != ENCODING_NONE && _data != NULL && _width > 0 && _height > 0);
}