Functional Problem Solving (CSC 151 2014F) : Reference

Integer-Encoded RGB Colors


Basic Integer-Encoded RGB Procedures

(irgb-new r g b)
MediaScheme Color Procedure. Build an integer-encoded RGB color whose red, green, and blue components are the specified values, each of which is an integer between 0 and 255, inclusive. If given real values, rounds them to the nearest integer. If given values outside the bouds, caps them at the bounds.
(irgb r g b)
MediaScheme Color Procedure. Build an integer-encoded RGB color whose red, green, and blue components are the specified values, each of which is an integer between 0 and 255, inclusive. If given real values, rounds them to the nearest integer. If given values outside the bouds, caps them at the bounds.
(irgb-red irgb-color)
MediaScheme Color Procedure. Get the red component of an integer-encoded RGB color.
(irgb-green color)
MediaScheme Color Procedure. Get the green component of an integer-encoded RGB color.
(irgb-blue irgb-color)
MediaScheme Color Procedure. Get the blue component of an integer-encoded RGB color.
(irgb? value)
MediaScheme Color Predicate. Determine if value can be interpreted as an integer-encoded RGB color. Warning! Almost any integer can be interpreted as an integer-encoded RGB color.

Converting To and From Integer-Encoded RGB Colors

(irgb->color-name irgb-color)
MediaScheme Color Procedure. Convert the given integer-encoded RGB color to a string that names a similar color. Note that this conversion approximates the RGB color as there are many fewer names than colors.
(irgb->hsv irgb-color)
MediaScheme Color Procedure. Convert the given integer-encoded RGB color to a list corresponding to the HSV (hue, saturation, value) representaiton.
(irgb->rgb-list irgb-color)
MediaScheme Color Procedure. Convert the given color to a list of its three components.
(irgb->string irgb-color)
MediaScheme Color Procedure. Convert the given RGB color to an easy-to-read string. (The string is not so easy to convert back to an RGB color.)
(color-name->irgb string)
MediaScheme Color Procedure. Get the integer-encoded RGB color that corresponds to the given color name.
(color->irgb string)
MediaScheme Color Procedure. Convert any of the myriad representations of colors to a corresponding integer-encoded RGB color.
(color->hsv color)
MediaScheme Color Procedure. Convert any of the myriad representations of colors to a corresponding HSV (hue, saturation, value) representation.
(rgb-list->irgb rgb-lst)
MediaScheme Color Procedure. Converts a list representation of a color of the form (r g b) into an integer-encoded RGB color.

Transforming Integer-Encoded RGB Colors

(irgb-lighter irgb-color)
MediaScheme Color Procedure. Build a lighter version of the given color.
(irgb-darker irgb-color)
MediaScheme Color Procedure. Build a darker version of the given color.
(irgb-redder irgb-color)
MediaScheme Color Procedure Build a redder version of the given color.
(irgb-greener irgb-color)
MediaScheme Color Procedure. Build a greener version of the given color.
(irgb-bluer irgb-color)
MediaScheme Color Procedure. Build a bluer version of the given color.
(irgb-rotate irgb-color)
MediaScheme Color Procedure. Rotate the three components of the given color, setting the red component to the value of the green component, the green component to the value of the blue component, and blue compnent to the value of the red component.
(irgb-phaseshift irgb-color)
MediaScheme Color Procedure.Phase shift” the color by adding 128 to components less than 128 and subtracting 128 from components greater than 128.
(irgb-complement irgb-color)
MediaScheme Color Procedure. Compute the psuedo-complement of the given color.

Miscellaneous Integer-Encoded RGB Functions

(irgb-map irgb-color fun)
MediaScheme Color Procedure. Create a new color by applying fun to each component of color.
(irgb->hue irgb-color)
MediaScheme Color Procedure. Get the hue of the given integer-encoded RGB color.
(irgb->saturation irgb-color)
MediaScheme Color Procedure. Get the saturation (from the HSV model) of the given integer-encoded RGB color.
(irgb->value irgb-color)
MediaScheme Color Procedure. Get the value (from the HSV model) of the given integer-encoded RGB color.