Img2Num C++ (Internal Developer Docs) dev
API Documentation
Loading...
Searching...
No Matches
LABAPixel.h
1#ifndef LABAPixel_H
2#define LABAPixel_H
3
4#include "internal/LABPixel.h"
5
6namespace ImageLib {
7template <typename NumberT>
8struct LABAPixel : public ImageLib::LABPixel<NumberT> {
9 // ----- Members -----
10 NumberT alpha;
11
12 // ----- Constructors -----
13 constexpr LABAPixel(NumberT l = 0, NumberT a = 0, NumberT b = 0, NumberT alpha = 255)
14 : LABPixel<NumberT>(l, a, b), alpha(alpha) {
15 }
16
17 // ----- Modifiers -----
18 [[nodiscard]] inline bool operator==(const LABAPixel &other) const {
19 return LABPixel<NumberT>::operator==(other) && alpha == other.alpha;
20 }
21 [[nodiscard]] inline bool operator!=(const LABAPixel &other) const {
22 return !(*this == other);
23 }
24
25 // ----- Utilities -----
26 inline void setGray(NumberT gray, NumberT alpha = 255) {
28 this->alpha = alpha;
29 }
30
31} __attribute__((packed));
32
33template <typename NumberT>
34std::ostream &operator<<(std::ostream &out, const ImageLib::LABAPixel<NumberT> &pixel) {
35 out << "( " << pixel.l << "," << pixel.a << "," << pixel.b << "," << pixel.alpha << " )";
36 return out;
37}
38
39} // namespace ImageLib
40
41#endif // LABAPixel_H