double ARGBColor::GetValue() { double hue; double sat; double val; GetHSV(hue, sat, val); return val; }
double ARGBColor::GetSaturation() { double hue; double sat; double val; GetHSV(hue, sat, val); return sat; }
void ARGBColor::SetSaturation(double newSat) { double hue; double sat; double val; GetHSV(hue, sat, val); SetHSV(hue, newSat, val); }
void ARGBColor::SetValue(double newVal) { double hue; double sat; double val; GetHSV(hue, sat, val); SetHSV(hue, sat, newVal); }
void ARGBColor::SetHue(double newHue) { double hue; double sat; double val; GetHSV(hue, sat, val); SetHSV(newHue, sat, val); }
IMAGE *AdjustValue(IMAGE *image, double percent) { // To be completed by student ... // This function adjusts the value (perceived luminance of all pixels in an image by a certain percent unsigned row = GetRows(image); unsigned col = GetCols(image); unsigned i, j; double hue, sat, val; for (i=0; i<row; i++) { for (j=0; j<col; j++) { //these for loops traverses through the 2D image GetHSV( image, i, j, &hue, &sat, &val); //retreives the values PutHSV( image, i, j, hue, sat, val*(percent/100)); //changes the value by the parameter percent } } return image; }
IMAGE *AdjustSaturation(IMAGE *image, double percent) { // To be completed by student ... // this function adjusts the saturation of all pixels by a certain percent unsigned row = GetRows(image); unsigned col = GetCols(image); unsigned i, j; double hue, sat, val; for(i=0; i<row; i++) { for (j=0; j<col; j++) { //these loops traverses the image GetHSV( image, i, j, &hue, &sat, &val); //retreives the values PutHSV( image, i, j, hue, sat*(percent/100), val); //adjusts the sat value } } return image; }
IMAGE *AdjustHue(IMAGE *image, double degrees) { // To be completed by student ... //This function adjusts the hue in all pixels of an image by a certain amount of degrees unsigned row = GetRows(image); unsigned col = GetCols(image); unsigned i, j; double hue, sat, val; for (i=0; i<row; i++) { for (j=0; j<col; j++) { //traverses the array GetHSV(image, i, j, &hue, &sat, &val); //retreives the values PutHSV(image, i, j, hue + degrees, sat, val); //adjusts the hue value } } return image; }
void Color::SetSaturation(const glm::float32& sat) { glm::f32vec4 hsv = GetHSV(); hsv.y = sat; SetHSV(hsv); }
const glm::float32 Color::GetSaturation() const { return GetHSV().y; }
void Color::SetHue(const glm::float32& hue) { glm::f32vec4 hsv = GetHSV(); hsv.x = hue; SetHSV(hsv); }
const glm::float32 Color::GetHue() const { return GetHSV().x; }
void Color::SetValue(const glm::float32& val) { glm::f32vec4 hsv = GetHSV(); hsv.z = val; SetHSV(hsv); }
const glm::float32 Color::GetValue() const { return GetHSV().z; }
float wxColourExt::HsvHue() const { GetHSV(&H1, &S1, &V1); return H1; }
float wxColourExt::HsvValue() const { GetHSV(&H1, &S1, &V1); return V1; }
float wxColourExt::HsvSaturation() const { GetHSV(&H1, &S1, &V1); return S1; }