This assignment requires familiarity with the lecture materials presented in class through week 07.
You may be familiar with RGB colors, and/or the RGB color model. It's a pretty simple idea, where values representing an amount of red, green, and blue light are “added” together to form a color. This is a common representation due to the fact that the pixels on most screens (such as LCDs and CRTs) are generated by devices that emit red, green or blue light, mainly because those are three wavelengths of light to which human eyes are most sensitive (for fairly obvious reasons).
As per the arbiter of all human information:
HSL (for hue, saturation, lightness) and HSV (for hue, saturation, value; also known as HSB, for hue, saturation, brightness) are alternative representations of the RGB color model, designed in the 1970s by computer graphics researchers to more closely align with the way human vision perceives color-making attributes. In these models, colors of each hue are arranged in a radial slice, around a central axis of neutral colors which ranges from black at the bottom to white at the top.
Using a representation like HSV makes it much easier to modify and interpret colors in an intuitive way, such as calculating complementary colors or varying a color's apparent brightness/intensity.
You shall create a class in the cs19
namespace named HsvColor
, defined in header file cs19_hsv_color.h
and implemented in file cs19_hsv_color.cpp
. Instances of cs19::HsvColor
represent immutable HSV colors, where each of the three components (hue, saturation and value) of a color is represented as a float
. cs19::HsvColor
also offers a few overloaded operators and other functions, including several related to converting a HSV color to its equivalent 24-bit RGB components.
Specifically, design your class to accommodate at least the public functions specified in this documentation. You may add other functions if you'd like, as long as they don't interfere with the expected functionality.
Once the basic parts of your class are complete, you can try running this demo code that exercises class cs19::HsvColor
and produces an HTML document on standard output. If your class has enough functionality to support this demo, it should produce a web page identical to this one. You can try the following and compare your results with those expected:
g++ hsv_color_demo.cpp cs19_hsv_color.cpp -o hsv_color_demo ./hsv_color_demo >~/public_html/hsv_color_demo.html
Now visit the following URLs and compare them visually to check for any discrepancies:
jeff.cis.cabrillo.edu/datasets/docs_cs19_hsv_color/hsv_color_demo.html
jeff.cis.cabrillo.edu/~/hsv_color_demo.html
<iostream>
makes it very easy to print and parse integers formatted in hexadecimal into output streams and from input streams.
Submit cs19_hsv_color.h
and cs19_hsv_color.cpp
via turnin.
Feedback Robot
This project has a feedback robot that will run some tests on your submission and provide you with a feedback report via email within roughly one minute.
Please read the feedback carefully.
Due at 23:59:59 on the date listed on the syllabus.
Assignment 07
is worth 60 points.
Possible point values per category: --------------------------------------- Class functionality 60 (split as evenly as possible between member functions) Possible deductions: Style and practices 10–20% Possible extra credit: Submission via Git 5% ---------------------------------------