-
-
Save Chovelice/3606196 to your computer and use it in GitHub Desktop.
CS225
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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