22 MGPixel(
unsigned data=0){m_pixel.uint=data;};
27 unsigned char getRed()
const{
return m_pixel.uchar[0];};
28 unsigned char getGreen()
const{
return m_pixel.uchar[1];};
29 unsigned char getBlue()
const{
return m_pixel.uchar[2];};
30 unsigned char getAlpha()
const{
return m_pixel.uchar[3];};
32 unsigned int getPixel()
const{
return m_pixel.uint;};
35 void setRed(
unsigned char R){m_pixel.uchar[0]=R;};
36 void setGreen(
unsigned char G){m_pixel.uchar[1]=G;};
37 void setBlue(
unsigned char B){m_pixel.uchar[2]=B;};
38 void setAlpha(
unsigned char A){m_pixel.uchar[3]=A;};
41 void setRGB(
const MGPixel& pixel2);
43 void setPixel(
unsigned int pixel){m_pixel.uint=pixel;};
45 unsigned char&
operator[](
unsigned i){
return m_pixel.uchar[i];};
46 const unsigned char&
operator[](
unsigned i)
const{
return m_pixel.uchar[i];};
51 bool isNull()
const{
return m_pixel.uint==0;};
61 unsigned char uchar[4];
void setRed(unsigned char R)
Definition: Pixel.h:35
const unsigned char * getPixelAsChar() const
Definition: Pixel.h:33
void setBlue(unsigned char B)
Definition: Pixel.h:37
unsigned char getAlpha() const
Definition: Pixel.h:30
unsigned int getPixel() const
Definition: Pixel.h:32
MGPixel(unsigned data=0)
Definition: Pixel.h:22
unsigned char & operator[](unsigned i)
Definition: Pixel.h:45
MGColor defines the OpenGL color (R,G,B,A).
Definition: Color.h:26
unsigned char getGreen() const
Definition: Pixel.h:28
const unsigned char & operator[](unsigned i) const
Definition: Pixel.h:46
void setPixel(unsigned int pixel)
Definition: Pixel.h:43
MGPixel & operator|=(unsigned int data)
Definition: Pixel.h:48
void setGreen(unsigned char G)
Definition: Pixel.h:36
bool isNull() const
Test if this pixel is null pixel(that is, RGBA=(0,0,0,0)).
Definition: Pixel.h:51
unsigned char getRed() const
Definition: Pixel.h:27
unsigned char getBlue() const
Definition: Pixel.h:29
void setAlpha(unsigned char A)
Definition: Pixel.h:38
MGPixel & operator&=(unsigned int data)
Definition: Pixel.h:47
Define MGPixel Class of (R,G,B,A) pixel data.
Definition: Pixel.h:18