From c59deae728bcc33713d093b3d8f7cecae43ac56e Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Thu, 29 Aug 2013 18:34:53 -0400 Subject: [PATCH] Add accessors for the color channels and a method for packing the information into a 32 bit RGBA int --- PVRTCEncoder/src/Pixel.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/PVRTCEncoder/src/Pixel.h b/PVRTCEncoder/src/Pixel.h index 50ee075..20619ae 100644 --- a/PVRTCEncoder/src/Pixel.h +++ b/PVRTCEncoder/src/Pixel.h @@ -88,6 +88,29 @@ class Pixel { // above for how we do this. static uint8 ChangeBitDepth(uint8 val, uint8 oldDepth, uint8 newDepth); + const uint8 &A() const { return m_A; } + uint8 &A() { return m_A; } + const uint8 &R() const { return m_R; } + uint8 &R() { return m_R; } + const uint8 &G() const { return m_G; } + uint8 &G() { return m_G; } + const uint8 &B() const { return m_B; } + uint8 &B() { return m_B; } + const uint8 &Component(uint32 idx) const { return m_Component[idx]; } + uint8 &Component(uint32 idx) { return m_Component[idx]; } + + uint32 PackRGBA() const { + uint32 r = 0; + r |= m_A; + r <<= 8; + r |= m_B; + r <<= 8; + r |= m_G; + r <<= 8; + r |= m_R; + return r; + } + private: union { struct {