Porytiles
Loading...
Searching...
No Matches
rgba32.cpp
Go to the documentation of this file.
2
3#include <string>
4
5namespace porytiles {
6
7std::string Rgba32::ToJascStr() const {
8 return std::to_string(red_) + " " + std::to_string(green_) + " " + std::to_string(blue_);
9}
10
11bool Rgba32::EqualsIgnoringAlpha(const Rgba32 &other) const {
12 return red_ == other.red_ && green_ == other.green_ && blue_ == other.blue_;
13}
14
15// std::ostream &operator<<(std::ostream &os, const Rgba32 &rgba) {
16// // For debugging purposes, print the solid colors with names rather than int values
17// if (rgba == kRgbaBlack || rgba == bgrToRgba(BGR_BLACK)) {
18// os << "black";
19// } else if (rgba == kRgbaRed || rgba == bgrToRgba(BGR_RED)) {
20// os << "red";
21// } else if (rgba == kRgbaGreen || rgba == bgrToRgba(BGR_GREEN)) {
22// os << "green";
23// } else if (rgba == kRgbaBlue || rgba == bgrToRgba(BGR_BLUE)) {
24// os << "blue";
25// } else if (rgba == kRgbaYellow || rgba == bgrToRgba(BGR_YELLOW)) {
26// os << "yellow";
27// } else if (rgba == kRgbaMagenta || rgba == bgrToRgba(BGR_MAGENTA)) {
28// os << "magenta";
29// } else if (rgba == kRgbaCyan || rgba == bgrToRgba(BGR_CYAN)) {
30// os << "cyan";
31// } else if (rgba == kRgbaWhite || rgba == bgrToRgba(BGR_WHITE)) {
32// os << "white";
33// } else if (rgba == kRgbaGrey || rgba == bgrToRgba(BGR_GREY)) {
34// os << "grey";
35// } else if (rgba == kRgbaPurple || rgba == bgrToRgba(BGR_PURPLE)) {
36// os << "purple";
37// } else if (rgba == kRgbaLime || rgba == bgrToRgba(BGR_LIME)) {
38// os << "lime";
39// } else {
40// os << std::to_string(rgba.red()) << "," << std::to_string(rgba.green()) << "," <<
41// std::to_string(rgba.blue()); if (rgba.alpha() != 255) {
42// // Only show alpha if not opaque
43// os << "," << std::to_string(rgba.alpha());
44// }
45// }
46// return os;
47// }
48
49} // namespace porytiles
std::string ToJascStr() const
Definition rgba32.cpp:7
bool EqualsIgnoringAlpha(const Rgba32 &other) const
Definition rgba32.cpp:11