Skip to content

Instantly share code, notes, and snippets.

@Chovelice
Forked from chao2zhang/RGBAPixel.cpp
Created September 3, 2012 02:01
Show Gist options
  • Save Chovelice/3606196 to your computer and use it in GitHub Desktop.
Save Chovelice/3606196 to your computer and use it in GitHub Desktop.
CS225
#include "rgbapixel.h"
/**
* This function constructs a default pixel which is opaque
* (non-transparent) and white.
**/
RGBAPixel::RGBAPixel()
{
alpha = 255;
red = 255;
green = 255;
blue = 255;
}
/**
* This function constructs an opaque RGBAPixel with given red,
* green, and blue color values.
**/
RGBAPixel::RGBAPixel(unsigned char red_in,
unsigned char green_in,
unsigned char blue_in)
{
red = red_in;
green = green_in;
blue = blue_in;
alpha = 255;
}
/**
* Represents a single pixel in an image.
**/
class RGBAPixel
{
public:
/**
* Constructs a default RGBAPixel.
**/
RGBAPixel();
/**
* Constructs an opaque RGBAPixel with the given red, green, blue
* color values.
**/
RGBAPixel(unsigned char red, unsigned char green, unsigned char blue);
/**
* @param alpha Byte for the alpha component of the pixel.
* @param red Byte for the red component of the pixel.
* @param green Byte for the green component of the pixel.
* @param blue Byte for the blue component of the pixel.
**/
unsigned char alpha;
unsigned char red;
unsigned char green;
unsigned char blue;
};
#endif //RGBAPIXEL_H
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment