aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/color/rgba.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/utils/color/rgba.cpp (renamed from src/utils/rgba_color.cpp)26
1 files changed, 8 insertions, 18 deletions
diff --git a/src/utils/rgba_color.cpp b/src/utils/color/rgba.cpp
index aed484f6..777bb720 100644
--- a/src/utils/rgba_color.cpp
+++ b/src/utils/color/rgba.cpp
@@ -24,16 +24,11 @@
#include <cstddef>
-#include "rgba_color.hpp"
+#include "rgba.hpp"
namespace usdx
{
- RgbaColor::RgbaColor(int red, int green, int blue, int alpha)
- : RgbColor(red, green, blue), alpha(alpha/255.0f)
- {
- }
-
- RgbaColor::RgbaColor(float red, float green, float blue, float alpha)
+ RgbaColor::RgbaColor(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha)
: RgbColor(red, green, blue), alpha(alpha)
{
}
@@ -43,12 +38,7 @@ namespace usdx
{
}
- RgbaColor::RgbaColor(const RgbColor& color, int alpha)
- : RgbColor(color), alpha(alpha / 255.0f)
- {
- }
-
- RgbaColor::RgbaColor(const RgbColor& color, float alpha)
+ RgbaColor::RgbaColor(const RgbColor& color, uint8_t alpha)
: RgbColor(color), alpha(alpha)
{
}
@@ -73,7 +63,7 @@ namespace usdx
return *this;
}
- float RgbaColor::get_alpha(void) const
+ uint8_t RgbaColor::get_alpha(void) const
{
return alpha;
}
@@ -92,10 +82,10 @@ namespace usdx
array_length = len;
for (size_t i = 0; i < len; i++) {
- array[i*components] = get_red() * 255.0f;
- array[(i*components) + 1] = get_green() * 255.0f;
- array[(i*components) + 2] = get_blue() * 255.0f;
- array[(i*components) + 3] = alpha * 255.0f;
+ array[i*components] = get_red();
+ array[(i*components) + 1] = get_green();
+ array[(i*components) + 2] = get_blue();
+ array[(i*components) + 3] = alpha;
}
}