MRaster lib 21.0.0.0
Image Processing Library
|
Template Class used to house colors for ramCanvas objects. More...
#include <MRcolorTpl.hpp>
Classes | |
class | cs2dFltPalArg |
Compute a color for a point in \(\mathbb{R}^2\) using a continuous color scheme for the phase angle. More... | |
class | cs2dIdxPalArg |
Compute a color for a point in \(\mathbb{R}^2\) using a discrete color scheme for the phase angle. More... | |
class | cs2dRichardson |
Compute a color from Richardson's 2D complex number coloring scheme. More... | |
class | cs2dThaller_tpl |
Template for Thaller 2D color schemes. More... | |
class | csBin_tpl |
Binary color scheme. More... | |
class | csCB_tpl |
Template for Color Brewer 2 variable sized pallets. More... | |
class | csCC_tpl |
Template providing RGB color cube gradiant color schemes. More... | |
class | csCubeHelix_tpl |
Compute a color from Dave Green's cubehelix scheme. More... | |
class | csFP_tpl |
Template for fixed size pallets. More... | |
class | csHSLh_tpl |
Template for HSL color schemes. More... | |
class | csPLY_tpl |
Compute a color from a polynomial space curve in the RGB color space. More... | |
class | csVarToFixed_tpl |
Wrapper for Color Brewer 2 variable sized pallet template to produce a simple fixed color scheme with a numC member. More... | |
class | csWS_tpl |
Template for web safe 216 pallets. More... | |
Public Enums Constants | |
enum class | cornerColorEnum { BLACK , RED , GREEN , BLUE , YELLOW , CYAN , MAGENTA , WHITE } |
Colors at the corners of the RGB color cube. More... | |
enum class | colorSpaceEnum { RGB , HSL , HSV , LAB , XYZ , LCH , NONE } |
Color spaces. More... | |
enum class | cmfInterpolationEnum { FLOOR , CEILING , NEAREST , LINEAR , BUMP } |
Interpolation methods for emperical color matching functions. More... | |
Public type related types – meta-types? ;) | |
typedef colorTpl | colorType |
This object type. | |
typedef colorType * | colorPtrType |
Pointer to colorTpl. | |
typedef colorType & | colorRefType |
Reference to colorTpl) | |
typedef colorType const & | colorCRefType |
Reference to const colorTpl. | |
typedef clrChanT | channelType |
Type for the channels (clrChanT) | |
Public types for std::tuple & std::vector containing clrChanT values | |
typedef std::tuple< clrChanT, clrChanT, clrChanT, clrChanT > | clrChanTup6 |
typedef std::tuple< clrChanT, clrChanT, clrChanT, clrChanT > | clrChanTup5 |
typedef std::tuple< clrChanT, clrChanT, clrChanT, clrChanT > | clrChanTup4 |
typedef std::tuple< clrChanT, clrChanT, clrChanT > | clrChanTup3 |
typedef std::tuple< clrChanT, clrChanT > | clrChanTup2 |
typedef std::tuple< clrChanT > | clrChanTup1 |
typedef std::vector< clrChanT > | clrChanVec |
Public types for for packed integers. | |
typedef uint32_t | packed4Cint |
Used for passing & returning integers with packed 8-bit channels. | |
Public color types related to colorT. | |
These types are used for things like color space computations and sources for setting channels, etc... | |
typedef colorTpl< double, 3 > | colConDbl3 |
Used for color space computations. Type identical to colConRGBdbl, but might not be RGB. | |
typedef colorTpl< double, 3 > | colConRGBdbl |
RGB with double channels. | |
typedef colorTpl< double, 4 > | colConRGBAdbl |
RGBA with double channels. | |
typedef colorTpl< uint8_t, 3 > | colConRGBbyte |
RGB with uint8_t channels. | |
typedef colorTpl< uint8_t, 4 > | colConRGBAbyte |
RGBA with uint8_t channels. | |
typedef colorTpl< double, numChan > | colConALLdbl |
Color with the same number of challens as colorT, but with double channels. | |
typedef colorTpl< uint8_t, numChan > | colConALLbyte |
Color with the same number of challens as colorT, but with uint8_t channels. | |
Public type for argument passing | |
typedef std::conditional< ptrIsSmaller, colorCRefType, colorType >::type | colorArgType |
A type for passing colorTpl objects to functions. | |
2D Color Schemes | |
template<double cutDepth, double argCuts, double absCuts, bool logAbs> | |
using | cs2dThallerHSL = cs2dThaller_tpl<1, 0, cutDepth, argCuts, absCuts, logAbs> |
Compute a color from Bernd Thaller's 2D complex number coloring scheme with HSL. | |
template<double cutDepth, double argCuts, double absCuts, bool logAbs> | |
using | cs2dThallerHSVm = cs2dThaller_tpl<0, 1, cutDepth, argCuts, absCuts, logAbs> |
Compute a color from Bernd Thaller's 2D complex number coloring scheme with HSV and maximum value. | |
template<double cutDepth, double argCuts, double absCuts, bool logAbs> | |
using | cs2dThallerHSV = cs2dThaller_tpl<0, 0, cutDepth, argCuts, absCuts, logAbs> |
Compute a color from Bernd Thaller's 2D complex number coloring scheme with HSV and dynamic value. | |
template<class csT , class csAT > | |
colorTpl & | csSet (csAT csArg) |
template<class csT , class csAT > | |
colorTpl & | csSet (csAT csArg1, csAT csArg2) |
Private Object Data | ||
union { | ||
maskType theInt | ||
clrChanT thePartsA [numChan] | ||
} | theColor | |
Holds the color channel data. | ||
Public Constants Related to RGBA channels | |
static constexpr int | noRGBchanIdx = (redChanIdx < 0) && (greenChanIdx < 0) && (blueChanIdx < 0) && (alphaChanIdx < 0) |
static constexpr int | redChan = (noRGBchanIdx && numChan > 0 ? 0 : redChanIdx) |
static constexpr int | greenChan = (noRGBchanIdx && numChan > 1 ? 1 : greenChanIdx) |
static constexpr int | blueChan = (noRGBchanIdx && numChan > 2 ? 2 : blueChanIdx) |
static constexpr int | alphaChan = (noRGBchanIdx && numChan > 3 ? 3 : alphaChanIdx) |
Public Constants Related to template paramaters | |
static constexpr int | bitsPerChan = (int)(sizeof(clrChanT)*CHAR_BIT) |
Number of bits in clrChanT. | |
static constexpr int | bitsPerPixel = numChan*bitsPerChan |
Number of color data bits. | |
static constexpr bool | chanIsInt = std::is_integral<clrChanT>::value |
clrChanT is an integral type | |
static constexpr bool | chanIsFloat = std::is_floating_point<clrChanT>::value |
clrChanT is a floating pint type | |
static constexpr bool | chanIsUnsigned = std::is_unsigned<clrChanT>::value |
clrChanT is an unsigned integral type | |
static constexpr bool | chanIsByte = std::is_same<clrChanT, uint8_t>::value |
is clrChanT an 8-bit unsigned int? | |
static constexpr bool | chanIsDouble = std::is_same<clrChanT, double>::value |
is clrChanT a double? | |
static constexpr bool | goodMask = (sizeof(maskType) >= sizeof(clrChanT)*numChan) |
maskType is big enough | |
static constexpr bool | perfectMask = (sizeof(maskType) == sizeof(clrChanT)*numChan) |
maskType is perfectly sized | |
static constexpr bool | goodArithD = (chanIsFloat || (sizeof(channelArithDType) >= sizeof(clrChanT)*2)) |
channelArithDType is big enough | |
static constexpr bool | goodArithSP = (chanIsFloat || (sizeof(channelArithSPType) >= sizeof(clrChanT)*2)) |
channelArithSPType is big enough | |
static constexpr bool | goodArithSDP = (chanIsFloat || (sizeof(channelArithSDPType) >= sizeof(clrChanT)*4)) |
channelArithSDPType is big enough | |
static constexpr bool | goodArithFlt = (chanIsFloat || (sizeof(channelArithFltType) > sizeof(clrChanT))) |
channelArithFltType is big enough | |
static constexpr bool | goodArithLog = (sizeof(channelArithLogType) == sizeof(clrChanT)) |
channelArithLogType is the right size | |
static constexpr int | sizeOfColor = (int)(goodMask ? sizeof(maskType) : sizeof(clrChanT)*numChan) |
Size of this object. | |
static constexpr bool | ptrIsSmaller = sizeOfColor > (int)sizeof(colorPtrType) |
This object smaller than a pointer. | |
static constexpr clrChanT | maxChanVal = (chanIsInt ? std::numeric_limits<clrChanT>::max() : 1) |
maximum value for a channel | |
static constexpr clrChanT | minChanVal = (chanIsInt ? std::numeric_limits<clrChanT>::min() : 0) |
maximum value for a channel | |
static constexpr clrChanT | meanChanVal = (maxChanVal-minChanVal)/2 |
middle value for a channel | |
static constexpr maskType | maskAllOne = ~(static_cast<maskType>(0)) |
mask value all ones | |
static constexpr maskType | maskAllZero = static_cast<maskType>(0) |
mask value all zeros | |
static constexpr int | channelCount = numChan |
Number of channels. | |
Color Scheme Constants | |
static constexpr csIntType | chanStepMax = (chanIsInt ? static_cast<csIntType>(maxChanVal) : std::numeric_limits<uint32_t>::max()) |
Finite "steps" for a color scheme: [0, chanStepMax]. | |
static constexpr int | minWavelength = 360 |
Minimum wavelength for wavelength conversion. | |
static constexpr int | maxWavelength = 830 |
Maximum wavelength for wavelength conversion. | |
Default RGB Luminescence Weights | |
static constexpr double | RGBluminanceWeightR = 0.2126 |
static constexpr double | RGBluminanceWeightG = 0.7152 |
static constexpr double | RGBluminanceWeightB = 0.0722 |
Private utility functions | |
double | hslHelperVal (double n1, double n2, double hue) |
This is a helper function for setRGBfromColorSpace. | |
void | setChansToMean () |
Set all channels to meanChanVal. | |
void | setChansToMin () |
Set all channels to minChanVal. | |
void | setChansToMax () |
Set all channels to maxChanVal. | |
colorTpl & | setColorFromString (std::string colorString) |
Sets the current color based upon the contents of the given std::string. | |
clrChanT | convertByteToChan (uint8_t cVal) const |
Convert a uint8_t to a clrChanT (for integral clrChanT) | |
clrChanT | convertByteToChan (uint8_t cVal) const |
Convert a uint8_t to a clrChanT (for floating point clrChanT) | |
clrChanT | convertHexStringToChan (std::string hexString) const |
Convert hex CString to clrChanT (for integral clrChanT) | |
clrChanT | convertHexStringToChan (std::string hexString) const |
Convert hex CString to clrChanT (for floating point clrChanT) | |
uint8_t | convertChanToByte (clrChanT cVal) const |
Convert a clrChanT to a uint8_t (for floating point clrChanT) | |
uint8_t | convertChanToByte (clrChanT cVal) const |
Convert a clrChanT to a uint8_t (for integral clrChanT) | |
clrChanT | convertDoubleToChan (double cVal) const |
Convert a double to a clrChanT. | |
double | convertChanToDouble (clrChanT cVal) const |
Convert a clrChanT to a double. | |
maskType | getMaskNC () const |
Return the mask value. | |
void | setMaskNC (maskType aMask) |
Set the mask value. | |
Constructors: C++ Utility | |
colorTpl () | |
The no arg constructor is a noop so we don't needlessly initialize millions of pixels – compiler warnings are expected. | |
colorTpl (const colorType &aColor) | |
Copy constructor (heavily used for assignment in the ramCanvas library). | |
colorTpl (std::initializer_list< clrChanT > cVals) | |
Initializer list. | |
Constructors: RGB | |
These all use setChansRGB or setChansRGBA internally; however, these constructors will set any unspecified channels to min. | |
colorTpl (clrChanT r, clrChanT g, clrChanT b, clrChanT a) | |
colorTpl (clrChanT r, clrChanT g, clrChanT b) | |
Constructors: Conversions | |
These are all guarnteed to set all channels of the object. | |
colorTpl (clrChanT cVal) | |
Uses setChans() to set all channels to the given value. | |
colorTpl (cornerColorEnum cornerColor) | |
Uses the setToCorner() method to set the initialize the object. | |
colorTpl (std::string colorString) | |
Uses the setColorFromString() method to set the initialize the object. | |
colorTpl (const char *colorCString) | |
Uses the setColorFromString() method to set the initialize the object. | |
Destructor | |
~colorTpl () | |
The destructor for this class is a no-op. | |
Utility Methods | |
colorTpl & | copy (colorArgType aCol) |
Copy the contents of the given color object into the current object. | |
Named Channel Access | |
Provides access to the specified color channel value with compile time index check.
| |
clrChanT | getRed () const |
clrChanT | getBlue () const |
clrChanT | getGreen () const |
clrChanT | getAlpha () const |
double | getRed_dbl () const |
double | getGreen_dbl () const |
double | getBlue_dbl () const |
double | getAlpha_dbl () const |
uint8_t | getRed_byte () const |
uint8_t | getGreen_byte () const |
uint8_t | getBlue_byte () const |
uint8_t | getAlpha_byte () const |
clrChanT | getC0 () const |
clrChanT | getC1 () const |
clrChanT | getC2 () const |
clrChanT | getC3 () const |
double | getC0_dbl () const |
double | getC1_dbl () const |
double | getC2_dbl () const |
double | getC3_dbl () const |
uint8_t | getC0_byte () const |
uint8_t | getC1_byte () const |
uint8_t | getC2_byte () const |
uint8_t | getC3_byte () const |
Indexed Channel Access | |
Provides access to an indexed color channel value with run time index check. The channels are 0 indexed.
| |
clrChanT | getChan (int chan) const |
double | getChan_dbl (int chan) const |
uint8_t | getChan_byte (int chan) const |
Set Named Channel Value | |
Provides access to the specified color channel value with compile time index check.
| |
colorTpl & | setC0 (clrChanT cVal) |
colorTpl & | setC1 (clrChanT cVal) |
colorTpl & | setC2 (clrChanT cVal) |
colorTpl & | setC3 (clrChanT cVal) |
colorTpl & | setC0_dbl (double cVal) |
colorTpl & | setC1_dbl (double cVal) |
colorTpl & | setC2_dbl (double cVal) |
colorTpl & | setC3_dbl (double cVal) |
colorTpl & | setC0_byte (uint8_t cVal) |
colorTpl & | setC1_byte (uint8_t cVal) |
colorTpl & | setC2_byte (uint8_t cVal) |
colorTpl & | setC3_byte (uint8_t cVal) |
colorTpl & | setRed (clrChanT cVal) |
colorTpl & | setBlue (clrChanT cVal) |
colorTpl & | setGreen (clrChanT cVal) |
colorTpl & | setAlpha (clrChanT cVal) |
colorTpl & | setRed_dbl (double cVal) |
colorTpl & | setGreen_dbl (double cVal) |
colorTpl & | setBlue_dbl (double cVal) |
colorTpl & | setAlpha_dbl (double cVal) |
colorTpl & | setRed_byte (uint8_t cVal) |
colorTpl & | setGreen_byte (uint8_t cVal) |
colorTpl & | setBlue_byte (uint8_t cVal) |
colorTpl & | setAlpha_byte (uint8_t cVal) |
colorTpl & | setChansRGBA (clrChanT r, clrChanT g, clrChanT b, clrChanT a) |
colorTpl & | setChansRGB (clrChanT r, clrChanT g, clrChanT b) |
colorTpl & | setChansRGBA_dbl (double r, double g, double b, double a) |
colorTpl & | setChansRGB_dbl (double r, double g, double b) |
colorTpl & | setChansRGBA_byte (uint8_t r, uint8_t g, uint8_t b, uint8_t a) |
colorTpl & | setChansRGB_byte (uint8_t r, uint8_t g, uint8_t b) |
colorTpl & | setChansRGBA (clrChanTup4 chanValues) |
colorTpl & | setChansRGB (clrChanTup3 chanValues) |
Canonical Color Types. | |
Provide conversions to/from canonical color types. | |
colorTpl & | setChans_dbl (colConALLdbl dblColor) |
colorTpl & | setChans_byte (colConALLbyte byteColor) |
colorTpl & | setChansRGBA_dbl (colConRGBAdbl dblColor) |
colorTpl & | setChansRGB_dbl (colConRGBdbl dblColor) |
colorTpl & | setChansRGBA_byte (colConRGBAbyte byteColor) |
colorTpl & | setChansRGB_byte (colConRGBbyte byteColor) |
colConALLdbl | getColCon_dbl () |
colConALLbyte | getColCon_byte () |
colConRGBAdbl | getColConRGBA_dbl () |
colConRGBdbl | getColConRGB_dbl () |
colConRGBAbyte | getColConRGBA_byte () |
colConRGBbyte | getColConRGB_byte () |
Best guess for named channel index. | |
These are used when we wish to get the named channel index, but the current color might not have specified an approprate value. | |
int | bestRedChan () |
int | bestGreenChan () |
int | bestBlueChan () |
int | bestAlphaChan () |
Setting a single Channel by Index | |
Provides access to an indexed color channel value with run time index check. The channels are 0 indexed.
| |
colorTpl & | setChanToMax (int chan) |
colorTpl & | setChanToMin (int chan) |
colorTpl & | setChan (int chan, clrChanT cVal) |
colorTpl & | setChan_dbl (int chan, double cVal) |
colorTpl & | setChan_byte (int chan, uint8_t cVal) |
Set/Get Single Channel values with no index checks. | |
| |
colorTpl & | setChanNC (int chan, clrChanT cVal) |
Sets the specified color channel value with no index check. | |
clrChanT | getChanNC (int chan) const |
Provides access to an specified color channel value with no index check. | |
Set All Channel Values To One Value | |
Sets all components of the current object from to cVal.
| |
colorTpl & | setChans (clrChanT cVal) |
colorTpl & | setChans_dbl (double cVal) |
colorTpl & | setChans_byte (uint8_t cVal) |
Set Channel Value(s) with clrChanT values | |
colorTpl & | setChans (clrChanTup4 chanValues) |
Sets the first four channels current object. | |
colorTpl & | setChans (clrChanTup3 chanValues) |
Sets the first three channels current object. | |
colorTpl & | setChans (clrChanVec &chanValues) |
This function sets color channels from the data in a std::vector. | |
colorTpl & | setChans (std::string colorHexString, bool clearUndefinedChannels=false) |
Sets the current color based upon the contents of the given color hex string. | |
Set To Special Colors (RGB Corners) | |
While the assumed color model is RGB, these functions are generalized beyond RGB in that non-RGB channels are uniformly, and usefully, manipulated. For example, setToBlack and setToWhite functions set all channels to minimum and maximum respectively – both reasonable definitions for "black" and "white" in many situations. The "primary" colors (red, blue, and green) set all non-RGB channels to minimum, and the "secondary" colors (cyan, yellow, and magenta) set all non-RGB channels to max. The reason for this difference in behavior on non-RGB channels between primary and secondary colors is two fold: 1) It allows the setTo*() functions to complete their work using no more than two assignment statements for channel objects with integer channels and good masks. 2) It makes each secondary an inverse (a logical NOT for integer colors) color from a primary across all channels. Note that the other functions in this group end with a call to one of the setTo*() functions. | |
colorTpl & | setToBlack () |
colorTpl & | setToWhite () |
colorTpl & | setToRed () |
colorTpl & | setToBlue () |
colorTpl & | setToGreen () |
colorTpl & | setToCyan () |
colorTpl & | setToYellow () |
colorTpl & | setToMagenta () |
colorTpl & | setToHalf () |
colorTpl & | setToCorner (char cornerColor) |
Set the current color based upon the single character given – 0==black, R, G, B, M, C, Y, W/1==white). | |
colorTpl & | setToCorner (cornerColorEnum cornerColor) |
Set the color to the given corner color. | |
colorTpl & | setToCorner (std::string cornerColor) |
Set the color to the named corner color. | |
Color Setting Methods via Logically Packed Integers. | |
By "logically" we mean as if the integers were written on paper left to right with MSB on the left – the same way they are "written" in C++ source code. ex: 0x11223344u has 11 as the most significant byte, but it might be placed in memory differently. These functions are very usefully for unpacking integers derived from integer literals in C++ code. setRGBfromLogPackIntARGB() is heavily used for color schemes. | |
colorTpl & | setRGBAfromLogPackIntGen (packed4Cint anInt, uint8_t rIdx, uint8_t gIdx, uint8_t bIdx, uint8_t aIdx) |
Set the color based upon the bytes of the given integer ordered from LSB to MSB. | |
colorTpl & | setRGBfromLogPackIntGen (packed4Cint anInt, uint8_t rIdx, uint8_t gIdx, uint8_t bIdx) |
Just like setRGBAfromLogPackIntGen, but no A. | |
colorTpl & | setRGBAfromLogPackIntARGB (packed4Cint anInt) |
colorTpl & | setRGBfromLogPackIntARGB (packed4Cint anInt) |
colorTpl & | setRGBAfromLogPackIntRGBA (packed4Cint anInt) |
colorTpl & | setRGBfromLogPackIntRGBA (packed4Cint anInt) |
colorTpl & | setRGBAfromLogPackIntABGR (packed4Cint anInt) |
colorTpl & | setRGBfromLogPackIntABGR (packed4Cint anInt) |
colorTpl & | setRGBAfromLogPackIntBGRA (packed4Cint anInt) |
colorTpl & | setRGBfromLogPackIntBGRA (packed4Cint anInt) |
colorTpl & | setRGBAfromLogPackIntABRG (packed4Cint anInt) |
colorTpl & | setRGBfromLogPackIntABRG (packed4Cint anInt) |
TGA Height Maps for POVray | |
colorTpl & | setRGBcmpGreyTGA16bit (uint32_t tga16val) |
Computes a 24-bit truecolor value intended for use in producing 16-bit greyscale TGA. | |
colorTpl & | setRGBcmpGreyTGA24bit (uint32_t tga24val) |
Computes a 24-bit truecolor value intended for use in producing 24-bit greyscale TGA. | |
Color Setting Methods via Physically Packed Integers. | |
By "physically" we mean as the bytes are physically ordered in RAM – which may differ from how we write them on paper or in C++ code. | |
colorTpl & | setRGBAfromPackIntGen (packed4Cint anInt, uint8_t rIdx, uint8_t gIdx, uint8_t bIdx, uint8_t aIdx) |
Set the color based upon the bytes of the given integer ordered as in RAM. | |
colorTpl & | setRGBfromPackIntGen (packed4Cint anInt, uint8_t rIdx, uint8_t gIdx, uint8_t bIdx) |
Just like setRGBAfromPackIntGen, but no A. | |
Setting Colors Based Upon Other Color Spaces | |
Other Colorspaces. The most common use case is to think of the image as holding RGB color data, and these functions are designed with that idea in mind. Note that alternate colorspaces computations all take place with double floating point values. Various other tools are also available for manipulating colors in other colorspaces (see: interplColorSpace() and rgb2colorSpace() for example).. See the colorSpaceEnum for details regarding supported colorspaces. | |
colorTpl & | setRGBfromUnitHSV (double H, double S, double V) |
Set the color indicated by the given HSV values. | |
colorTpl & | setRGBfromUnitHSL (double H, double S, double L) |
Set the color indicated by the given HSL values. | |
colorTpl & | setRGBfromColorSpace (colorSpaceEnum space, double inCh1, double inCh2, double inCh3) |
Set the color indicated by the color space and values. | |
colorTpl & | setRGBfromColorSpace (colorSpaceEnum space, colConDbl3 inColor) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
Setting Colors Based Upon Spectral Color | |
colorTpl & | setRGBfromWavelengthCM (double wavelength, cmfInterpolationEnum interpMethod=cmfInterpolationEnum::LINEAR) |
Set the color indicated by the given wavelength. | |
colorTpl & | setRGBfromWavelengthLA (double wavelength) |
Set the color indicated by the given wavelength. | |
Color Ramps, Gradients, Interpolation, Binary Thresholds. | |
Members in this section form the computational foundation for many of the named color schemes found in this class. | |
colorTpl & | cmpGradiant (csFltType csX, std::vector< csFltType > const &anchors, std::vector< colorType > const &colors) |
Convert a double to a color value based upon a color ramp passing through the given sequence of corner colors at the given anchor points. | |
colorTpl & | cmpGradiant (csFltType csX, std::vector< colorType > const &colors) |
Identical to the other cmpGradiant() function except that equidistant anchors are automatically generated on [0, 1] for the given colors array. | |
colorTpl & | cmpGradiant (csFltType csX, csIntType numColors, const packed4Cint *colors) |
Identical to the other equidistant cmpGradiant() function except that this one works on just the RGB channels and takes an array of packed integers. | |
colorTpl & | cmpRGBcornerCGradiant (csFltType csX, const char *cornerColors) |
This is simply a version of cmpRGBcornerCGradiant() that computes the length of the final argument as a C-string. | |
colorTpl & | cmpRGBcornerDGradiant (csIntType csIdx, const char *cornerColors) |
This is simply a version of cmpRGBcornerDGradiant() that computes the length of the final argument as a C-string. | |
template<typename ccT > | |
colorTpl & | cmpRGBcornerDGradiant (csIntType csIdx, csIntType numColors, const ccT *cornerColors) |
Color value based upon a color ramp passing through the given sequence of corner colors at equal intervals along [0, (mjr::colorTpl::chanStepMax * (numColors - 1) + 1)]. | |
template<typename ccT > | |
colorTpl & | cmpRGBcornerCGradiant (csFltType csX, csIntType numColors, const ccT *cornerColors) |
Color value based upon a color ramp passing through the given sequence of corner colors at equal intervals along [0.0, 1.0]. | |
colorTpl & | interplColorSpace (colorSpaceEnum space, double aDouble, colorArgType col1, colorArgType col2) |
Set the current color to a value linearly interpolated between the two given colors. | |
colorTpl & | wMean (channelArithFltType w1, channelArithFltType w2, channelArithFltType w3, channelArithFltType w4, colorArgType col1, colorArgType col2, colorArgType col3, colorArgType col4) |
Compute the weighted mean of the given colors. | |
colorTpl & | wMean (channelArithFltType w1, channelArithFltType w2, channelArithFltType w3, colorArgType col1, colorArgType col2, colorArgType col3) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
colorTpl & | wMean (channelArithFltType w1, channelArithFltType w2, colorArgType col1, colorArgType col2) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
colorTpl & | uMean (channelArithFltType w1, channelArithFltType w2, channelArithFltType w3, colorArgType col1, colorArgType col2, colorArgType col3, colorArgType col4) |
Compute the unit weighted mean of the given colors – like wMean(), but last weight is computed such that weights sum to 1.0. | |
colorTpl & | uMean (channelArithFltType w1, channelArithFltType w2, colorArgType col1, colorArgType col2, colorArgType col3) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
colorTpl & | uMean (channelArithFltType w1, colorArgType col1, colorArgType col2) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
colorTpl & | linearInterpolate (double aDouble, colorArgType col1, colorArgType col2) |
Set the current color to a value linearly interpolated between the two given colors. | |
colorTpl & | linearInterpolateRGB (double aDouble, colorArgType col1, colorArgType col2) |
Set the RGB channels of the current color to a value linearly interpolated between the two given colors. | |
Logical Operators | |
colorTpl & | tfrmOr (colorArgType aCol) |
Performs a logical OR with the current object and the given object and places the value in the current object. | |
colorTpl & | tfrmOr (colorArgType aCol) |
Template specialization member function differing from the above function only in supported template conditions. | |
colorTpl & | tfrmNor (colorArgType aCol) |
Performs a logical NOR with the current object and the given object and places the value in the current object. | |
colorTpl & | tfrmNor (colorArgType aCol) |
Template specialization member function differing from the above function only in supported template conditions. | |
colorTpl & | tfrmAnd (colorArgType aCol) |
Performs a logical AND with the current object and the given object and places the value in the current object. | |
colorTpl & | tfrmAnd (colorArgType aCol) |
Template specialization member function differing from the above function only in supported template conditions. | |
colorTpl & | tfrmNand (colorArgType aCol) |
Performs a logical NAND with the current object and the given object and places the value in the current object. | |
colorTpl & | tfrmNand (colorArgType aCol) |
Template specialization member function differing from the above function only in supported template conditions. | |
colorTpl & | tfrmXor (colorArgType aCol) |
Performs a logical EXCLUSIVE OR (XOR) with the current object and the given object and places the value in the current object. | |
colorTpl & | tfrmXor (colorArgType aCol) |
Template specialization member function differing from the above function only in supported template conditions. | |
colorTpl & | tfrmNxor (colorArgType aCol) |
Performs a logical NOT EXCLUSIVE OR (NXOR) with the current object and the given object and places the value in the current object. | |
colorTpl & | tfrmNxor (colorArgType aCol) |
Template specialization member function differing from the above function only in supported template conditions. | |
colorTpl & | tfrmNot (void) |
Performs logical (bit-wise) negation of current object. | |
colorTpl & | tfrmNot (void) |
Template specialization member function differing from the above function only in supported template conditions. | |
Arithmetic Operators | |
colorTpl & | tfrmSqDiff (colorArgType aCol) |
Computes the square of the difference for each channel between the given color and the current color object. | |
colorTpl & | tfrmAbsDiff (colorArgType aCol) |
Computes the absolute value of the difference for each channel between the given color and the current color object. | |
colorTpl & | tfrmAdd (colorArgType aCol) |
Computes the arithmetic sum of the given color and the current one. | |
colorTpl & | tfrmDiv (colorArgType aCol) |
Computes the arithmetic division of the current color by the given color. | |
colorTpl & | tfrmMult (colorArgType aCol) |
Computes the arithmetic product of the given color and the current one. | |
colorTpl & | tfrmMultClamp (colorArgType aCol) |
Computes the product of the given color and the current one. | |
colorTpl & | tfrmSignDiff (colorArgType aCol) |
Computes the component wise scaled sign of the difference between the current color and the given one. | |
colorTpl & | tfrmDiffClamp (colorArgType aCol) |
Computes the arithmetic difference of the given color from the current one. | |
colorTpl & | tfrmNegDiffClamp (colorArgType aCol) |
Computes the negative of the arithmetic difference of the given color from the current one. | |
colorTpl & | tfrmAddClamp (colorArgType aCol) |
Computes the arithmetic sum of the given color from the current one. | |
colorTpl & | tfrmAddDivClamp (colorArgType aCol, colorArgType dCol) |
Computes the arithmetic sum of the current color and aCol, then divids by dCol. | |
colorTpl & | tfrmDiff (colorArgType aCol) |
Computes the arithmetic difference of the given color from the current one. | |
colorTpl & | tfrmMod (colorArgType aCol) |
Computes the arithmetic modulus of the current by the given one. | |
colorTpl & | tfrmMod (colorArgType aCol) |
Template specialization member function differing from the above function only in supported template conditions. | |
colorTpl & | tfrmInvert () |
Transforms the color: r=maxChanVal-r, g=maxChanVal-r, and b=maxChanVal-b. | |
Named Operators | |
colorTpl & | tfrmPow (double p) |
Power: c=maxChanVal*(c/maxChanVal)^p. | |
colorTpl & | tfrmLn1 () |
Adds 1.0 and takes the natural logarithm of each channel. | |
colorTpl & | tfrmLn (double scale) |
Computes ln(c)*scale for each channel value c. | |
colorTpl & | tfrmMix (double aDouble, colorArgType tooCol) |
Linearly interpolate between the current color and the given color (at a point scaled the unit interval). | |
colorTpl & | tfrmCopy (colorArgType aCol) |
Copies the given argument into the current color object. | |
colorTpl & | tfrmMaxI (colorArgType aCol) |
Makes the current color the maximum of the current color or the given color. | |
colorTpl & | tfrmMinI (colorArgType aCol) |
Makes the current color the minimum of the current color or the given color. | |
colorTpl & | tfrmMax (colorArgType aCol) |
Makes each component of the current color the maximum of that component and the corresponding component of the given color. | |
colorTpl & | tfrmMin (colorArgType aCol) |
Makes each component of the current color the minimum of that component and the corresponding component of the given color. | |
colorTpl & | tfrmShiftL (colorArgType aCol) |
The Shift Left Transform modifies the current color. | |
colorTpl & | tfrmShiftL (colorArgType aCol) |
Template specialization member function differing from the above function only in supported template conditions. | |
colorTpl & | tfrmShiftR (colorArgType aCol) |
The Shift Right Transform modifies the current color. | |
colorTpl & | tfrmShiftR (colorArgType aCol) |
Template specialization member function differing from the above function only in supported template conditions. | |
colorTpl & | tfrmSaw (colorArgType lowCol, colorArgType highCol) |
The Saw Transform modifies the current color: C_i = ifelse(ra<=C_i<=rb, C_i, 0) | |
colorTpl & | tfrmStep (colorArgType lowCol, colorArgType highCol) |
The Saw Transform modifies the current color: C_i = ifelse(ra<=C_i<=rb, maxChanVal, 0) | |
colorTpl & | tfrmDiracTot (colorArgType aCol) |
The DiracTot (total) Transform modifies the current color: Set current color to white if it equals aCol, and black otherwise. | |
colorTpl & | tfrmDirac (colorArgType aCol) |
The Dirac Transform modifies the current color: C_i = ifelse(C_i==aCol.C_i, maxChanVal, 0) | |
colorTpl & | tfrmFuzzyDirac (colorArgType ctrCol, colorArgType radCol) |
The Fuzzy Dirac Transform modifies the current color: C_i=ifelse(|R-ctrCol.R|<=radCol.R), maxChanVal, 0) | |
colorTpl & | tfrmMean (colorArgType aCol) |
Computes the arithmetic mean of the given color and the current one. | |
colorTpl & | tfrmGmean (colorArgType aCol) |
Computes the geometric mean of the given color and the current one. | |
colorTpl & | tfrmGreyScaleRGB (void) |
Transform the current color by rendering it into a true grey via the same method used by the luminanceRGB() function. | |
Color Reduction Transformations | |
colorTpl & | tfrmWebSafeRGB () |
The 216 Palate Web Safe Transform modifies the current color into the closest web safe color from the 216 color web safe pallet. | |
Alternate Color Space Stuff | |
colConDbl3 | rgb2colorSpace (colorSpaceEnum space) const |
Compute channels for given color space coordinates for the current color. | |
std::string | colorSpaceToString (colorSpaceEnum space) |
Compute channels for given color space coordinates for the current color. | |
Color Transformation Functions | |
colorTpl & | tfrmLinearGreyLevelScale (double c, double b) |
The Linear Grey Level Scale transform modifies the current color such that: C_n=c*C_n+b. | |
colorTpl & | tfrmLinearGreyLevelScaleRGB (double rc, double rb, double gc, double gb, double bc, double bb) |
The Linear Grey Level Scale transform modifies the current color such that: R=rc*R+rb, G=gc*G+gb, B=bc*B+bb. | |
colorTpl & | tfrmComplexCut (std::complex< double > z, double cutDepth, double argCuts, double absCuts, bool logAbs=true) |
Perform a tfrmLinearGreyLevelScale based on a complex number. | |
colorTpl & | tfrmStdPow (double p) |
The Standard Power Transform modifies the current color such that: C_i = maxChanVal*(C_i / maxChanVal)**p. | |
colorTpl & | tfrmStdPowRGB (double rp, double gp, double bp) |
The Standard Power Transform modifies the current color such that: R=maxChanVal*(R/maxChanVal)**rp, B=maxChanVal*(B/maxChanVal)**gp, B=maxChanVal*(B/maxChanVal)**bp. | |
colorTpl & | tfrmStdPowSqr (void) |
The Standard Power Transform with p=2. | |
colorTpl & | tfrmStdPowSqrt (void) |
The Standard Power Transform with p=1/2. | |
Mathematical Operations On Color(s) | |
Members in this section produce non-color results. i.e. They consume the current, and possibly other colors and arguments, to produce a non-color result. | |
channelArithFltType | rgb2GreyDotProd (channelArithFltType redWt=RGBluminanceWeightR, channelArithFltType greenWt=RGBluminanceWeightG, channelArithFltType blueWt=RGBluminanceWeightB) const |
Use the R, G, & B channels to compute a floating point value representing a grey scale. | |
channelArithFltType | luminanceRGB (void) const |
Compute the luminance of the current color via the definition given in the ITU-R Recommendation BT.709. | |
channelArithSPType | intensityRGB (void) const |
Compute the unscaled intensity (sum of the R, G, & B components) of the current color. | |
channelArithSPType | intensity () const |
Compute the sum of the components. | |
channelArithFltType | intensityScaledRGB () const |
Compute the scaled intensity (sum of the first three components divided by the maximum intensity possible) of the current color. | |
channelArithFltType | intensityScaled () const |
Compute the scaled intensity (sum of the components divided by the maximum intensity possible) of the current color. | |
clrChanT | getMaxC () const |
Returns the value of the largest component. | |
clrChanT | getMinC () const |
Returns the value of the smallest component. | |
clrChanT | getMaxRGB () const |
Returns the value of the largest component from R, G, and B. | |
clrChanT | getMinRGB () const |
Returns the value of the smallest component from R, G, and B. | |
channelArithFltType | dotProd (colorArgType aColor) const |
Compute the dot product between the current color and the given color. | |
channelArithFltType | distHypot (colorArgType aColor) const |
Distance between current color and given one (sum squares of channel differences – Euclidean distance squared). | |
channelArithSPType | distSumAbs (colorArgType aColor) const |
Distance between current color and given one (sum of absolute channel differences). | |
channelArithSPType | distMaxAbs (colorArgType aColor) const |
Distance between current color and given one (maximum of absolute value of channel differences). | |
double | distDeltaE1976 (colorArgType aColor) const |
LAB Delta E* distance between current color and given one. | |
double | distDeltaE1994 (colorArgType aColor) const |
LAB Delta E* 1994 (graphic arts) distance between current color and given one. | |
bool | isClose (colorArgType aColor, clrChanT epsilon) const |
Returns non-zero if the current color is close to aColor (the maximum delta between any two channels is less than or equal to epsilon). | |
bool | isCloseRGB (colorArgType aColor, clrChanT epsilon) const |
Like isClose(), but only checks the R, G, & B channels. | |
bool | isEqual (colorArgType aColor) const |
Returns non-zero if the current color is precicely equal to aColor. | |
bool | isEqualRGB (colorArgType aColor) const |
Like isEqual(), but only checks the R, G, & B channels. | |
bool | isNotEqual (colorArgType aColor) const |
Returns non-zero if the given color is logically NOT the same as the current color. | |
bool | isBlack () |
Returns non-zero if the given color is black (all componnets are zero) | |
bool | isBlackRGB () const |
LIke isBlack(), but only checks the R, G, & B channels. | |
Channel Clipping Functions | |
template<typename iT > requires (std::same_as<iT, clrChanT> || std::same_as<iT, channelArithDType> || std::same_as<iT, channelArithSPType> || std::same_as<iT, channelArithSDPType> || std::same_as<iT, channelArithLogType>) | |
clrChanT | clampTop (iT arithValue) |
Clamp a value to (infinity, maxChanVal]. | |
template<typename iT > requires (std::same_as<iT, clrChanT> || std::same_as<iT, channelArithDType> || std::same_as<iT, channelArithSPType> || std::same_as<iT, channelArithSDPType> || std::same_as<iT, channelArithLogType>) | |
clrChanT | clampBot (iT arithValue) |
Clamp a value to [minChanVal, infinity). | |
template<typename iT > requires (std::same_as<iT, clrChanT> || std::same_as<iT, channelArithDType> || std::same_as<iT, channelArithSPType> || std::same_as<iT, channelArithSDPType> || std::same_as<iT, channelArithLogType>) | |
clrChanT | clampAll (iT arithValue) |
Clamp a value to [minChanVal, maxChanVal]. | |
Template Class used to house colors for ramCanvas objects.
This template provides a rich API for color management, and may be used to store colors with a wide range of channel depth and count. This class is intended to be a "small concrete" class (as defined by Bjarne Stroustrup in "The C++ Programming Language"). That is to say, it is intended for use as a "fundamental" type for tools requiring a space efficient and high performance set of concrete objects representing colors. The canonical example is representing an image as a very large, rectangular array of colors.
While this class supports large channel counts and very deep channels, it is best optimized for colors that take less than 64-bits of RAM. This is because the library uses an integer to cover color channel array in RAM to make memory operations faster. With a compiler supporting ISO C++, this object should take no more than the maximum of sizeof(clrChanT)*numChan or the mask used to cover the data. See the next paragraph for details on the "mask".
The most common use cases are 24-bit RGB/RGBA and greyscale up to 64-bits deep. All of these types are smaller than a 64-bit pointer, so it is almost always better to pass these values around by reference. That said, some types are quite large – an RGBA image with 64-bit floating point channels requires 256 bits of RAM. For these larger color objects, it is more efficient to pass them by reference. Within the library, some care is taken to adapt to the size of the color object, and pass objects to functions by the most efficient means (value or const reference). The class provides a type the end user can employ to use this same strategy: colorArgType.
Within this object an integer mask and an array of numChan clrCompT are placed into a union – and thus are stacked upon each other in memory. When an integer type exists that can cover the entire channel array without wasting too much space, we can achieve serious performance gains. The trick is finding an integer big enough, but not so big it wastes space. Big enough means it is at least sizeof(clrChanT)*numChan chars long. The "not too big" constraint is more flexible, and I have elected to make a covering mask only if we waste no more than 1/4 of the RAM for the mask value. Examples:
When we can't cover the channel array, the mask type will be set to an uint8_t to avoid any alignment issues with the union.
Some common diagrams of common cases might help:
2222222222222222 Cover: 16-bits 11111111 1x8 Waste 1/2 => No Cover 1111111122222222 2x8 Waste 0/2 => Cover with 16-bits 44444444444444444444444444444444 Cover: 32-bits 111111112222222233333333 3x8 Waste 1/4 => Cover with 32-bits 11111111222222223333333344444444 4x8 Waste 0/4 => Cover with 32-bits 8888888888888888888888888888888888888888888888888888888888888888 1111111122222222333333334444444455555555 5x8 Waste 3/8 => No cover 111111112222222233333333444444445555555566666666 6x8 Waste 2/8 => Cover with 64-bits 111111111111111122222222222222223333333333333333 3x16 Waste 2/8 => Cover with 64-bits FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 1111111122222222333333334444444455555555666666667777777788888888999999990000000011111111 11x8 Waste 5/16 => No Cover 111111112222222233333333444444445555555566666666777777778888888899999999000000001111111122222222 12x8 Waste 4/16 => Cover with uint128_t 11111111111111112222222222222222333333333333333344444444444444445555555555555555 5x16 Waste 6/16 == No Cover 111111111111111122222222222222223333333333333333444444444444444455555555555555556666666666666666 6x16 Waste 4/16 => Cover with uint128_t 111111111111111111111111111111112222222222222222222222222222222233333333333333333333333333333333 3x32 Waste 4/16 => Cover with uint128_t
Several methods are provided that access and modify the internal color represented by a color object. In most cases, methods that modify the color object state return a reference to the object after the change. This provides, at a performance impact, the ability to use the value returned by such a function in the expression in which it appears. So, for example, it is not necessary to use two statements to change a color object's value and then use it in a drawing function. As another example, this provides the ability to do "method chaining" like so: aColor.setToRed().setToBlack() – which will lead to aColor being black. That said, it means we must use compiler optimization features to throw away this refrence if it is not used!!
Several methods are provided that transform the color object as a whole. For example, methods are provided to compute component-wise linear histogram transformations. Note that transformation methods are not provided to transform just one component of an object or a range of components. The philosophy is that the class provides methods that treat the color object as a whole and not methods that operate on single components. Just as we don't have a function to add the second half of two integers together – integers are one "thingy" and so are colors. :)
Several constructors are provided. All in all, the goal is to make it easy to construct color objects with a specified color.
|--------------------------------+---------------------+----------------------------------------| | Type | Member Helper | Cast Application | |--------------------------------+---------------------+----------------------------------------| | colorT | copy | | | four clrChanT | setChans | | | three clrChanT | setChans | | | two clrChanT | setChans | | | one clrChanT | setChans | drawPoint(x, y, 128); | | Named Corner Colors via string | setColorFromString | drawPoint(x, y, "Red"); | | Web hex string | setColorFromString | drawPoint(x, y, "#FF0000"); | | Extended web hex string | setColorFromString | drawPoint(x, y, "##FFFF00000000"); | | Single character string | setColorFromString | drawPoint(x, y, "R"); | | Named Corner Colors via ENUM | setToCorner | drawPoint(x, y, cornerColorEnum::RED); | |--------------------------------+---------------------+----------------------------------------|
clrChanT | Type to contain the channel information. This type should be a unsigned integral type, a float, or double. |
numChan | The number of channels this color will have. Common choices are 1 for greyscale, 3 for RGB, and 4 for RGBA. |
redChanIdx | Index for the Red channel. -1 indicates no Red chan. |
blueChanIdx | Index for the Blue channel. -1 indicates no Red channel. |
greenChanIdx | Index for the Green channel. -1 indicates no Red channel. |
alphaChanIdx | Index for the Alpha channel. -1 indicates no Red channel. If redChanIdx, blueChanIdx, greenChanIdx, & alphaChanIdx are all -1, then they will be assigned to channels 0, 1, 2, & 3 when numChan is >= 4. If they are all negative and numChan == 3, then alphaChanIdx won't be assigned, but red, blue, and green will be. |
Definition at line 201 of file MRcolorTpl.hpp.
typedef colorTpl mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::colorType |
This object type.
Definition at line 209 of file MRcolorTpl.hpp.
typedef colorType* mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::colorPtrType |
Pointer to colorTpl.
Definition at line 211 of file MRcolorTpl.hpp.
typedef colorType& mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::colorRefType |
Reference to colorTpl)
Definition at line 213 of file MRcolorTpl.hpp.
typedef colorType const& mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::colorCRefType |
Reference to const colorTpl.
Definition at line 215 of file MRcolorTpl.hpp.
typedef clrChanT mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::channelType |
Type for the channels (clrChanT)
Definition at line 217 of file MRcolorTpl.hpp.
typedef std::tuple<clrChanT, clrChanT, clrChanT, clrChanT> mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::clrChanTup6 |
Definition at line 223 of file MRcolorTpl.hpp.
typedef std::tuple<clrChanT, clrChanT, clrChanT, clrChanT> mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::clrChanTup5 |
Definition at line 224 of file MRcolorTpl.hpp.
typedef std::tuple<clrChanT, clrChanT, clrChanT, clrChanT> mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::clrChanTup4 |
Definition at line 225 of file MRcolorTpl.hpp.
typedef std::tuple<clrChanT, clrChanT, clrChanT> mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::clrChanTup3 |
Definition at line 226 of file MRcolorTpl.hpp.
typedef std::tuple<clrChanT, clrChanT> mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::clrChanTup2 |
Definition at line 227 of file MRcolorTpl.hpp.
typedef std::tuple<clrChanT> mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::clrChanTup1 |
Definition at line 228 of file MRcolorTpl.hpp.
typedef std::vector<clrChanT> mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::clrChanVec |
Definition at line 230 of file MRcolorTpl.hpp.
typedef uint32_t mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::packed4Cint |
Used for passing & returning integers with packed 8-bit channels.
Definition at line 236 of file MRcolorTpl.hpp.
typedef colorTpl<double, 3> mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::colConDbl3 |
Used for color space computations. Type identical to colConRGBdbl, but might not be RGB.
Definition at line 243 of file MRcolorTpl.hpp.
typedef colorTpl<double, 3> mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::colConRGBdbl |
RGB with double channels.
Definition at line 244 of file MRcolorTpl.hpp.
typedef colorTpl<double, 4> mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::colConRGBAdbl |
RGBA with double channels.
Definition at line 245 of file MRcolorTpl.hpp.
typedef colorTpl<uint8_t, 3> mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::colConRGBbyte |
RGB with uint8_t channels.
Definition at line 246 of file MRcolorTpl.hpp.
typedef colorTpl<uint8_t, 4> mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::colConRGBAbyte |
RGBA with uint8_t channels.
Definition at line 247 of file MRcolorTpl.hpp.
typedef colorTpl<double, numChan> mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::colConALLdbl |
Color with the same number of challens as colorT, but with double channels.
Definition at line 248 of file MRcolorTpl.hpp.
typedef colorTpl<uint8_t, numChan> mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::colConALLbyte |
Color with the same number of challens as colorT, but with uint8_t channels.
Definition at line 249 of file MRcolorTpl.hpp.
typedef std::conditional<ptrIsSmaller,colorCRefType,colorType>::type mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::colorArgType |
A type for passing colorTpl objects to functions.
WHen the size of a colorTpl object is smaller than a pointer, this type is colorTpl – resulting in pass by value. Otherwise, this type is colorType const& – resulting in pass by refrence.
Definition at line 549 of file MRcolorTpl.hpp.
using mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::cs2dThallerHSL = cs2dThaller_tpl<1, 0, cutDepth, argCuts, absCuts, logAbs> |
Compute a color from Bernd Thaller's 2D complex number coloring scheme with HSL.
See: Bernd Thaller (2000); Visual Quantum Mechanics; pp 2-8 This is a continuous, 2D color scheme!
cutDepth | See: tfrmComplexCut() |
argCuts | See: tfrmComplexCut() |
absCuts | See: tfrmComplexCut() |
logAbs | See: tfrmComplexCut() |
Definition at line 5100 of file MRcolorTpl.hpp.
using mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::cs2dThallerHSVm = cs2dThaller_tpl<0, 1, cutDepth, argCuts, absCuts, logAbs> |
Compute a color from Bernd Thaller's 2D complex number coloring scheme with HSV and maximum value.
See: Bernd Thaller (2000); Visual Quantum Mechanics; pp 2-8 This is a continuous, 2D color scheme!
cutDepth | See: tfrmComplexCut() |
argCuts | See: tfrmComplexCut() |
absCuts | See: tfrmComplexCut() |
logAbs | See: tfrmComplexCut() |
Definition at line 5110 of file MRcolorTpl.hpp.
using mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::cs2dThallerHSV = cs2dThaller_tpl<0, 0, cutDepth, argCuts, absCuts, logAbs> |
Compute a color from Bernd Thaller's 2D complex number coloring scheme with HSV and dynamic value.
See: Bernd Thaller (2000); Visual Quantum Mechanics; pp 2-8 This is a continuous, 2D color scheme!
cutDepth | See: tfrmComplexCut() |
argCuts | See: tfrmComplexCut() |
absCuts | See: tfrmComplexCut() |
logAbs | See: tfrmComplexCut() |
Definition at line 5120 of file MRcolorTpl.hpp.
|
strong |
Colors at the corners of the RGB color cube.
Definition at line 592 of file MRcolorTpl.hpp.
|
strong |
Color spaces.
This ENUM is used by setRGBfromColorSpace(), interplColorSpace(), and rgb2colorSpace(). In this context these color spaces use double values for each channel. Angles (the H of HSV, HSL, & LCH) are in degrees, and will always be normalized to [0, 360).
Definition at line 604 of file MRcolorTpl.hpp.
|
strong |
Interpolation methods for emperical color matching functions.
Enumerator | |
---|---|
FLOOR | closest lower |
CEILING | closest upper |
NEAREST | closest |
LINEAR | linear interpolation |
BUMP | exponential bump map interpolation |
Definition at line 613 of file MRcolorTpl.hpp.
|
inline |
The no arg constructor is a noop so we don't needlessly initialize millions of pixels – compiler warnings are expected.
Definition at line 627 of file MRcolorTpl.hpp.
|
inline |
Copy constructor (heavily used for assignment in the ramCanvas library).
Definition at line 630 of file MRcolorTpl.hpp.
References mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getMaskNC(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::theColor, and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::thePartsA.
|
inline |
Initializer list.
Unspecified channels are set ot minChanVal, and extra channel values are ignored.
Definition at line 640 of file MRcolorTpl.hpp.
|
inline |
Definition at line 657 of file MRcolorTpl.hpp.
|
inline |
Definition at line 662 of file MRcolorTpl.hpp.
|
inline |
Uses setChans() to set all channels to the given value.
cVal | The value to set the channels to |
Definition at line 676 of file MRcolorTpl.hpp.
|
inline |
Uses the setToCorner() method to set the initialize the object.
Note that no constructor exists taking a character to provide to setToCorner(). Why? Because character literals are integers in C++, and they might be the same as clrChanT – rendering ambiguous overload cases.
Definition at line 681 of file MRcolorTpl.hpp.
|
inline |
Uses the setColorFromString() method to set the initialize the object.
Definition at line 684 of file MRcolorTpl.hpp.
|
inline |
Uses the setColorFromString() method to set the initialize the object.
Definition at line 687 of file MRcolorTpl.hpp.
|
inline |
The destructor for this class is a no-op.
Definition at line 694 of file MRcolorTpl.hpp.
|
inlineprivate |
This is a helper function for setRGBfromColorSpace.
Definition at line 374 of file MRcolorTpl.hpp.
|
inlineprivate |
Set all channels to meanChanVal.
Definition at line 387 of file MRcolorTpl.hpp.
|
inlineprivate |
Set all channels to minChanVal.
Definition at line 390 of file MRcolorTpl.hpp.
|
inlineprivate |
Set all channels to maxChanVal.
Definition at line 398 of file MRcolorTpl.hpp.
|
inlineprivate |
Sets the current color based upon the contents of the given std::string.
This is the guts of the magic constructor taking a string. If colorString starts with a "#", then setChans() will be used. Otherwise setToCorner() will be used
Definition at line 408 of file MRcolorTpl.hpp.
|
inlineprivate |
Convert a uint8_t to a clrChanT (for integral clrChanT)
Definition at line 427 of file MRcolorTpl.hpp.
|
inlineprivate |
Convert a uint8_t to a clrChanT (for floating point clrChanT)
Definition at line 435 of file MRcolorTpl.hpp.
|
inlineprivate |
Convert hex CString to clrChanT (for integral clrChanT)
Definition at line 440 of file MRcolorTpl.hpp.
|
inlineprivate |
Convert hex CString to clrChanT (for floating point clrChanT)
Definition at line 448 of file MRcolorTpl.hpp.
|
inlineprivate |
Convert a clrChanT to a uint8_t (for floating point clrChanT)
Definition at line 456 of file MRcolorTpl.hpp.
|
inlineprivate |
Convert a clrChanT to a uint8_t (for integral clrChanT)
Definition at line 461 of file MRcolorTpl.hpp.
|
inlineprivate |
Convert a double to a clrChanT.
Definition at line 471 of file MRcolorTpl.hpp.
|
inlineprivate |
Convert a clrChanT to a double.
Definition at line 480 of file MRcolorTpl.hpp.
|
inlineprivate |
Return the mask value.
Definition at line 488 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::colorTpl().
|
inlineprivate |
Set the mask value.
Definition at line 500 of file MRcolorTpl.hpp.
|
inline |
Copy the contents of the given color object into the current object.
When sizeof(colorTpl)<=sizeof(maskType), this function consists of a single assignment statement. Otherwise it is O(numChan).
Definition at line 703 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::csWS_tpl< colors >::c().
|
inline |
Definition at line 720 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::csHSLh_tpl< corner >::c(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setChansRGB_byte(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setChansRGB_dbl(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setChansRGBA_byte(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setChansRGBA_dbl().
|
inline |
Definition at line 721 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::csHSLh_tpl< corner >::c(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setChansRGB_byte(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setChansRGB_dbl(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setChansRGBA_byte(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setChansRGBA_dbl().
|
inline |
Definition at line 722 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::csHSLh_tpl< corner >::c(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setChansRGB_byte(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setChansRGB_dbl(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setChansRGBA_byte(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setChansRGBA_dbl().
|
inline |
Definition at line 723 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setChansRGBA_byte(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setChansRGBA_dbl().
|
inline |
Definition at line 725 of file MRcolorTpl.hpp.
|
inline |
Definition at line 726 of file MRcolorTpl.hpp.
|
inline |
Definition at line 727 of file MRcolorTpl.hpp.
|
inline |
Definition at line 728 of file MRcolorTpl.hpp.
|
inline |
Definition at line 730 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::csWS_tpl< colors >::c().
|
inline |
Definition at line 731 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::csWS_tpl< colors >::c().
|
inline |
Definition at line 732 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::csWS_tpl< colors >::c().
|
inline |
Definition at line 733 of file MRcolorTpl.hpp.
|
inline |
Definition at line 735 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::distDeltaE1994(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::interplColorSpace(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setRGBfromColorSpace().
|
inline |
Definition at line 736 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::distDeltaE1994(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::interplColorSpace(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setRGBfromColorSpace().
|
inline |
Definition at line 737 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::distDeltaE1994(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::interplColorSpace(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setRGBfromColorSpace().
|
inline |
Definition at line 738 of file MRcolorTpl.hpp.
|
inline |
Definition at line 740 of file MRcolorTpl.hpp.
|
inline |
Definition at line 741 of file MRcolorTpl.hpp.
|
inline |
Definition at line 742 of file MRcolorTpl.hpp.
|
inline |
Definition at line 743 of file MRcolorTpl.hpp.
|
inline |
Definition at line 745 of file MRcolorTpl.hpp.
|
inline |
Definition at line 746 of file MRcolorTpl.hpp.
|
inline |
Definition at line 747 of file MRcolorTpl.hpp.
|
inline |
Definition at line 748 of file MRcolorTpl.hpp.
|
inline |
Definition at line 758 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::cmpRGBcornerDGradiant(), and mjr::operator<<().
|
inline |
Definition at line 765 of file MRcolorTpl.hpp.
|
inline |
Definition at line 772 of file MRcolorTpl.hpp.
|
inline |
Definition at line 793 of file MRcolorTpl.hpp.
|
inline |
Definition at line 794 of file MRcolorTpl.hpp.
|
inline |
Definition at line 795 of file MRcolorTpl.hpp.
|
inline |
Definition at line 796 of file MRcolorTpl.hpp.
|
inline |
Definition at line 798 of file MRcolorTpl.hpp.
|
inline |
Definition at line 799 of file MRcolorTpl.hpp.
|
inline |
Definition at line 800 of file MRcolorTpl.hpp.
|
inline |
Definition at line 801 of file MRcolorTpl.hpp.
|
inline |
Definition at line 803 of file MRcolorTpl.hpp.
|
inline |
Definition at line 804 of file MRcolorTpl.hpp.
|
inline |
Definition at line 805 of file MRcolorTpl.hpp.
|
inline |
Definition at line 806 of file MRcolorTpl.hpp.
|
inline |
Definition at line 808 of file MRcolorTpl.hpp.
|
inline |
Definition at line 809 of file MRcolorTpl.hpp.
|
inline |
Definition at line 810 of file MRcolorTpl.hpp.
|
inline |
Definition at line 811 of file MRcolorTpl.hpp.
|
inline |
Definition at line 813 of file MRcolorTpl.hpp.
|
inline |
Definition at line 814 of file MRcolorTpl.hpp.
|
inline |
Definition at line 815 of file MRcolorTpl.hpp.
|
inline |
Definition at line 816 of file MRcolorTpl.hpp.
|
inline |
Definition at line 818 of file MRcolorTpl.hpp.
|
inline |
Definition at line 819 of file MRcolorTpl.hpp.
|
inline |
Definition at line 820 of file MRcolorTpl.hpp.
|
inline |
Definition at line 821 of file MRcolorTpl.hpp.
|
inline |
Definition at line 823 of file MRcolorTpl.hpp.
|
inline |
Definition at line 824 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::csHSLh_tpl< corner >::c().
|
inline |
Definition at line 826 of file MRcolorTpl.hpp.
|
inline |
Definition at line 827 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::cs2dRichardson< cutDepth, argCuts, absCuts, logAbs >::c(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::csCubeHelix_tpl< start, rots, hue, gamma >::c(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::csPLY_tpl< coefs >::c().
|
inline |
Definition at line 829 of file MRcolorTpl.hpp.
|
inline |
Definition at line 830 of file MRcolorTpl.hpp.
|
inline |
Definition at line 832 of file MRcolorTpl.hpp.
|
inline |
Definition at line 833 of file MRcolorTpl.hpp.
|
inline |
Definition at line 840 of file MRcolorTpl.hpp.
References mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getChanNC().
|
inline |
Definition at line 841 of file MRcolorTpl.hpp.
References mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getChanNC().
|
inline |
Definition at line 842 of file MRcolorTpl.hpp.
References mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getAlpha(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getBlue(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getGreen(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getRed().
|
inline |
Definition at line 843 of file MRcolorTpl.hpp.
References mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getBlue(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getGreen(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getRed().
|
inline |
Definition at line 844 of file MRcolorTpl.hpp.
References mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getAlpha(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getBlue(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getGreen(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getRed().
|
inline |
Definition at line 845 of file MRcolorTpl.hpp.
References mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getBlue(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getGreen(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getRed().
|
inline |
Definition at line 847 of file MRcolorTpl.hpp.
References mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setChanNC().
|
inline |
Definition at line 848 of file MRcolorTpl.hpp.
References mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setChanNC().
|
inline |
Definition at line 849 of file MRcolorTpl.hpp.
|
inline |
Definition at line 850 of file MRcolorTpl.hpp.
|
inline |
Definition at line 851 of file MRcolorTpl.hpp.
|
inline |
Definition at line 852 of file MRcolorTpl.hpp.
|
inline |
Definition at line 860 of file MRcolorTpl.hpp.
|
inline |
Definition at line 868 of file MRcolorTpl.hpp.
|
inline |
Definition at line 878 of file MRcolorTpl.hpp.
|
inline |
Definition at line 890 of file MRcolorTpl.hpp.
|
inline |
Definition at line 907 of file MRcolorTpl.hpp.
|
inline |
Definition at line 913 of file MRcolorTpl.hpp.
|
inline |
Definition at line 919 of file MRcolorTpl.hpp.
|
inline |
Definition at line 925 of file MRcolorTpl.hpp.
|
inline |
Definition at line 930 of file MRcolorTpl.hpp.
|
inline |
Sets the specified color channel value with no index check.
Definition at line 943 of file MRcolorTpl.hpp.
References mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::thePartsA.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getColCon_byte(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getColCon_dbl().
|
inline |
Provides access to an specified color channel value with no index check.
Definition at line 946 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::distDeltaE1976(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setChans_byte(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setChans_dbl().
|
inline |
Definition at line 965 of file MRcolorTpl.hpp.
|
inline |
Definition at line 971 of file MRcolorTpl.hpp.
|
inline |
Definition at line 972 of file MRcolorTpl.hpp.
|
inline |
Sets the first four channels current object.
chanValues | The values for the components |
Definition at line 982 of file MRcolorTpl.hpp.
|
inline |
Sets the first three channels current object.
chanValues | The values for the components |
Definition at line 992 of file MRcolorTpl.hpp.
|
inline |
This function sets color channels from the data in a std::vector.
chanValues | A std::vector containing the color channels. |
Definition at line 1003 of file MRcolorTpl.hpp.
|
inline |
Sets the current color based upon the contents of the given color hex string.
A color hex string is similar to the hash hex strings used in HTML, but extended to larger depths and higher channel counts.
#FF0000 -- Red for an RGB color with 8-bit per channels #FFFF00000000 -- Red for an RGB color with 16-bit per channels #FF0000EE -- Red for an RGBA color with 8-bit per channels (with alpha set to EE) #FFFFFFFFFF -- White for a 5 channel color with 8-bit per channels
Fewer channel specifiers may be provided than channels in the current color, then the value of clearUndefinedChannels defines the behavior: NOOP or set them to minChanVal. If the colorHexString is somehow invalid, then all channels are considered undefined, and the action is defined by the value of clearUndefinedChannels.
colorHexString | Hex string specifying a color. |
clearUndefinedChannels | Specify error action and what to do with unspecified channels. |
Definition at line 1022 of file MRcolorTpl.hpp.
|
inline |
Definition at line 1064 of file MRcolorTpl.hpp.
|
inline |
Definition at line 1065 of file MRcolorTpl.hpp.
|
inline |
Definition at line 1066 of file MRcolorTpl.hpp.
|
inline |
Definition at line 1067 of file MRcolorTpl.hpp.
|
inline |
Definition at line 1068 of file MRcolorTpl.hpp.
|
inline |
Definition at line 1069 of file MRcolorTpl.hpp.
|
inline |
Definition at line 1070 of file MRcolorTpl.hpp.
|
inline |
Definition at line 1071 of file MRcolorTpl.hpp.
|
inline |
Definition at line 1072 of file MRcolorTpl.hpp.
|
inline |
Set the current color based upon the single character given – 0==black, R, G, B, M, C, Y, W/1==white).
The color is acutally set using one of the setTo*() functions. If cornerColor is invalid, then setToBlack().
cornerColor | Character specifying the color |
Definition at line 1078 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::csBin_tpl< a, b >::c(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::cmpRGBcornerCGradiant(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::cmpRGBcornerDGradiant().
|
inline |
Set the color to the given corner color.
The color is acutally set using one of the setTo*() functions. If cornerColor is invalid, then setToBlack().
cornerColor | Enum value specifying the color |
Definition at line 1105 of file MRcolorTpl.hpp.
|
inline |
Set the color to the named corner color.
If cornerColor is one character long, then the call is equivalent to setToCorner(cornerColor[0]). Otherwise a valid corner color name string is expected: red, blue, green, cyan, yellow, magenta, black, or white. If cornerColor is invalid, then setToBlack(). The color is actually set using one of the setTo*() functions.
cornerColor | String value specifying the color |
Definition at line 1127 of file MRcolorTpl.hpp.
|
inline |
Set the color based upon the bytes of the given integer ordered from LSB to MSB.
The *Idx arguments select which byte of the int is used for each channel – with LSB equal to index 0 and MSB equal to index 3. The extracted bytes are interpreted as by setChans_byte. Any channels beyond four are left untouched.
anInt | The integer from which to extract bytes to set color |
rIdx | Location of red byte in anInt |
gIdx | Location of green byte in anInt |
bIdx | Location of blue byte in anInt |
aIdx | Location of alpha byte in anInt |
Definition at line 1159 of file MRcolorTpl.hpp.
|
inline |
Just like setRGBAfromLogPackIntGen, but no A.
Definition at line 1174 of file MRcolorTpl.hpp.
|
inline |
Definition at line 1189 of file MRcolorTpl.hpp.
|
inline |
Definition at line 1190 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::csFP_tpl< colors >::c(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::csWS_tpl< colors >::c(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::csWS_tpl< colors >::c(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::cmpGradiant().
|
inline |
Definition at line 1191 of file MRcolorTpl.hpp.
|
inline |
Definition at line 1192 of file MRcolorTpl.hpp.
|
inline |
Definition at line 1193 of file MRcolorTpl.hpp.
|
inline |
Definition at line 1194 of file MRcolorTpl.hpp.
|
inline |
Definition at line 1195 of file MRcolorTpl.hpp.
|
inline |
Definition at line 1196 of file MRcolorTpl.hpp.
|
inline |
Definition at line 1198 of file MRcolorTpl.hpp.
|
inline |
Definition at line 1199 of file MRcolorTpl.hpp.
|
inline |
Computes a 24-bit truecolor value intended for use in producing 16-bit greyscale TGA.
This is the color scheme that should be used for POVray 16-bit height files
tga16val | An integer |
Definition at line 1210 of file MRcolorTpl.hpp.
|
inline |
Computes a 24-bit truecolor value intended for use in producing 24-bit greyscale TGA.
tga24val | An integer |
Definition at line 1223 of file MRcolorTpl.hpp.
|
inline |
Set the color based upon the bytes of the given integer ordered as in RAM.
The *Idx arguments select which byte of the int is used for each channel – with byte[0] being the first in RAM. The extracted bytes are interpreted as by setChans_byte. Any channels beyond four are left untouched.
anInt | The integer from which to extract bytes to set color |
rIdx | Location of red byte in anInt |
gIdx | Location of green byte in anInt |
bIdx | Location of blue byte in anInt |
aIdx | Location of alpha byte in anInt |
Definition at line 1248 of file MRcolorTpl.hpp.
|
inline |
Just like setRGBAfromPackIntGen, but no A.
Definition at line 1259 of file MRcolorTpl.hpp.
|
inline |
Set the color indicated by the given HSV values.
The 'unit' in the name indicates that the values for h, s, and v are the unit interval, [0,1].
H | The Hue. |
S | The Saturation. |
V | The Value |
Definition at line 1283 of file MRcolorTpl.hpp.
|
inline |
Set the color indicated by the given HSL values.
The 'unit' in the name indicates that The ranges for h, s, and v are the the unit interval – i.e. [0,1].
H | The Hue. |
S | The Saturation. |
L | The Lightness or Luminescence |
Definition at line 1291 of file MRcolorTpl.hpp.
|
inline |
Set the color indicated by the color space and values.
space | The colorspace |
inCh1 | Channel one value for given colorspace |
inCh2 | Channel two value for given colorspace |
inCh3 | Channel three value for given colorspace |
Definition at line 1299 of file MRcolorTpl.hpp.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1378 of file MRcolorTpl.hpp.
References mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getC0(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getC1(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getC2().
|
inline |
Set the color indicated by the given wavelength.
This function uses an algorithm based upon the color matching functions as tabulated in table 3 from Stockman and Sharpe (2000) – I believe they are taken from Stiles and Burch 10-degree (1959). Four of the algorithms are based upon simple linear interpolation, while one is based upon exponential bump functions closely matching the color matching functions. The method of interpolation may be specified via the final argument.
wavelength | The wavelength to convert into RGB |
interpMethod | Specify the interpolation method (see: cmfInterpolationEnum) |
Definition at line 1399 of file MRcolorTpl.hpp.
|
inline |
Set the color indicated by the given wavelength.
This function uses an algorithm based upon linear approximations to the color match functions. I believe the original algorithm is due to Dan Bruton, and his FORTRAN version is available (at least as of 1997) at http://www.physics.sfasu.edu/astro/color.html
wavelength | to convert |
Definition at line 1518 of file MRcolorTpl.hpp.
|
inline |
Convert a double to a color value based upon a color ramp passing through the given sequence of corner colors at the given anchor points.
The value of this function at aDouble equal to anchor[i] will be colors[i]. This is an extremely general function that is capable of replicating many of the more precise color ramp sequence functions in this library. The only defects are the lack of bit level precision and the poor performance – both due to the use of floating point arithmetic. Note this function operates correctly with any channel type and with an arbitrary number of channels – it is NOT limited to RGB colors or RGB color corners for anchors.
csX | The value to convert |
anchors | Doubles for which color equals the corresponding corner. |
colors | A vector of colors to use |
Definition at line 1591 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::csFP_tpl< colors >::c().
|
inline |
Identical to the other cmpGradiant() function except that equidistant anchors are automatically generated on [0, 1] for the given colors array.
Definition at line 1606 of file MRcolorTpl.hpp.
|
inline |
Identical to the other equidistant cmpGradiant() function except that this one works on just the RGB channels and takes an array of packed integers.
Definition at line 1621 of file MRcolorTpl.hpp.
|
inline |
This is simply a version of cmpRGBcornerCGradiant() that computes the length of the final argument as a C-string.
Unlike the version of cmpRGBcornerDGradiant() specifying numColors, this one requires the final argument to be a real C-string – i.e. it must have a terminating NULL. Note this function uses RGB corner colors as anchors, and is thus designed to work with RGB colors.
csX | The value to convert |
cornerColors | Characters specifying color (as used by setColor) |
Definition at line 1647 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::csCC_tpl< corners >::c().
|
inline |
This is simply a version of cmpRGBcornerDGradiant() that computes the length of the final argument as a C-string.
Unlike the version of cmpRGBcornerDGradiant() specifying numColors, this one requires the final argument to be a real C-string – i.e. it must have a terminating NULL. Note this function uses RGB corner colors as anchors, and is thus designed to work with RGB colors.
csIdx | The value to convert |
cornerColors | Characters specifying color (as used by setColor) |
Definition at line 1660 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::csCC_tpl< corners >::c().
|
inline |
Color value based upon a color ramp passing through the given sequence of corner colors at equal intervals along [0, (mjr::colorTpl::chanStepMax * (numColors - 1) + 1)].
At 0, the color will be the first specified color. At (mjr::colorTpl::chanStepMax * ( numColors - 1) + 1) it will be the last color specified color. This function uses precise integer arithmetic. cornerColors need not be a real C-string – i.e. no need for an terminating NULL. Note this function uses RGB corner colors as anchors, and is thus designed to work with RGB colors.
csIdx | The value to convert |
numColors | The number of colors |
cornerColors | An array of things that can be passed to setToCorner() – usually char or cornerColorEnum |
Definition at line 1676 of file MRcolorTpl.hpp.
References mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getChan(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setToCorner().
|
inline |
Color value based upon a color ramp passing through the given sequence of corner colors at equal intervals along [0.0, 1.0].
At 0, the color will be the first specified color. At 1.0 it will be the last color specified color. CornerColors need not be a real C-string – i.e. no need for an terminating NULL. Note this function uses RGB corner colors as anchors, and is thus designed to work with RGB colors.
csX | The value to convert |
numColors | The number of colors |
cornerColors | An array of things that can be passed to setToCorner() – usually char or cornerColorEnum |
Definition at line 1717 of file MRcolorTpl.hpp.
References mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::setToCorner().
|
inline |
Set the current color to a value linearly interpolated between the two given colors.
When aDouble is 0, the color is col1. When aDouble is 1 the new value is col2. The interpolation is done in HSL space – i.e. the given colors are converted to HSL, the interpolation is done, and the result is converted back to RGB and the current color is set. Unlike linearInterpolate, this function will NOT interpolate every channel. Rather, as this function deals specifically with RGB and HSL space, only the RGB channels will be interpolated.
space | The color space to use |
aDouble | The distance from col1 |
col1 | The starting color |
col2 | The ending color |
Definition at line 1745 of file MRcolorTpl.hpp.
References mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getC0(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getC1(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getC2(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::rgb2colorSpace().
|
inline |
Compute the weighted mean of the given colors.
w1 | The first weight |
w2 | The second weight |
w3 | The third weight |
w4 | The fourth weight |
col1 | The first color |
col2 | The second color |
col3 | The third color |
col4 | The fourth color |
Definition at line 1785 of file MRcolorTpl.hpp.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1797 of file MRcolorTpl.hpp.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1807 of file MRcolorTpl.hpp.
|
inline |
Compute the unit weighted mean of the given colors – like wMean(), but last weight is computed such that weights sum to 1.0.
w1 | The first weight in the range [0, 1) – the range not checked! |
w2 | The second weight in the range [0, 1) – the range not checked! |
w3 | The third weight in the range [0, 1) – the range not checked! |
col1 | The first color |
col2 | The second color |
col3 | The third color |
col4 | The fourth color |
Definition at line 1823 of file MRcolorTpl.hpp.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1829 of file MRcolorTpl.hpp.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1834 of file MRcolorTpl.hpp.
|
inline |
Set the current color to a value linearly interpolated between the two given colors.
When aDouble is 0, the color is col1. When aDouble is 1 the new value is col2. This method interpolates all channels without any color space conversions and as few type conversions as possible.
aDouble | The distance from col1 |
col1 | The starting color |
col2 | The ending color |
Definition at line 1845 of file MRcolorTpl.hpp.
|
inline |
Set the RGB channels of the current color to a value linearly interpolated between the two given colors.
When aDouble is 0, the color is col1. When aDouble is 1 the new value is col2. This method interpolates all channels without any color space conversions and as few type conversions as possible.
aDouble | The distance from col1 |
col1 | The starting color |
col2 | The ending color |
Definition at line 1859 of file MRcolorTpl.hpp.
|
inline |
Performs a logical OR with the current object and the given object and places the value in the current object.
aCol | The color to use in the computation. |
Definition at line 1874 of file MRcolorTpl.hpp.
|
inline |
Template specialization member function differing from the above function only in supported template conditions.
Definition at line 1885 of file MRcolorTpl.hpp.
|
inline |
Performs a logical NOR with the current object and the given object and places the value in the current object.
aCol | The color to use in the computation. |
Definition at line 1899 of file MRcolorTpl.hpp.
|
inline |
Template specialization member function differing from the above function only in supported template conditions.
Definition at line 1910 of file MRcolorTpl.hpp.
|
inline |
Performs a logical AND with the current object and the given object and places the value in the current object.
aCol | The color to use in the computation. |
Definition at line 1923 of file MRcolorTpl.hpp.
|
inline |
Template specialization member function differing from the above function only in supported template conditions.
Definition at line 1934 of file MRcolorTpl.hpp.
|
inline |
Performs a logical NAND with the current object and the given object and places the value in the current object.
aCol | The color to use in the computation. |
Definition at line 1947 of file MRcolorTpl.hpp.
|
inline |
Template specialization member function differing from the above function only in supported template conditions.
Definition at line 1958 of file MRcolorTpl.hpp.
|
inline |
Performs a logical EXCLUSIVE OR (XOR) with the current object and the given object and places the value in the current object.
aCol | The color to use in the computation. |
Definition at line 1971 of file MRcolorTpl.hpp.
|
inline |
Template specialization member function differing from the above function only in supported template conditions.
Definition at line 1982 of file MRcolorTpl.hpp.
|
inline |
Performs a logical NOT EXCLUSIVE OR (NXOR) with the current object and the given object and places the value in the current object.
aCol | The color to use in the computation. |
Definition at line 1995 of file MRcolorTpl.hpp.
|
inline |
Template specialization member function differing from the above function only in supported template conditions.
Definition at line 2006 of file MRcolorTpl.hpp.
|
inline |
Performs logical (bit-wise) negation of current object.
Definition at line 2018 of file MRcolorTpl.hpp.
|
inline |
Template specialization member function differing from the above function only in supported template conditions.
Definition at line 2029 of file MRcolorTpl.hpp.
|
inline |
Computes the square of the difference for each channel between the given color and the current color object.
aCol | The color to use in the computation. |
Definition at line 2047 of file MRcolorTpl.hpp.
|
inline |
Computes the absolute value of the difference for each channel between the given color and the current color object.
aCol | The color to use in the computation. |
Definition at line 2057 of file MRcolorTpl.hpp.
|
inline |
Computes the arithmetic sum of the given color and the current one.
aCol | The color to use in the computation. |
Definition at line 2066 of file MRcolorTpl.hpp.
|
inline |
Computes the arithmetic division of the current color by the given color.
If a channel of aCol is zero, then the corresponding channel of the current color object will be left untouched.
aCol | The color to use in the computation. |
Definition at line 2076 of file MRcolorTpl.hpp.
|
inline |
Computes the arithmetic product of the given color and the current one.
aCol | The color to use in the computation. |
Definition at line 2086 of file MRcolorTpl.hpp.
|
inline |
Computes the product of the given color and the current one.
If the result of a multiplication is too large, it will be set to the maximum component value.
aCol | The color to use in the computation. |
Definition at line 2096 of file MRcolorTpl.hpp.
|
inline |
Computes the component wise scaled sign of the difference between the current color and the given one.
As an example of the computation, the red component of the current color is computed like this:
aCol | The color to use in the computation. |
Definition at line 2109 of file MRcolorTpl.hpp.
|
inline |
Computes the arithmetic difference of the given color from the current one.
If the result a differences is negative, then that component will be set to zero.
aCol | The color to use in the computation. |
Definition at line 2126 of file MRcolorTpl.hpp.
|
inline |
Computes the negative of the arithmetic difference of the given color from the current one.
This is the same as the arithmetic difference of the current color from the given color. If the result a differences is negative, then that component will be set to zero.
aCol | The color to use in the computation. |
Definition at line 2137 of file MRcolorTpl.hpp.
|
inline |
Computes the arithmetic sum of the given color from the current one.
If the result of a sum is greater than the maximum value, then that component will be set to the maximum value.
aCol | The color to use in the computation. |
Definition at line 2147 of file MRcolorTpl.hpp.
|
inline |
Computes the arithmetic sum of the current color and aCol, then divids by dCol.
If the result is greater than the maximum value, then that component will be set to the maximum value. If a channel of dCol is zero, then the corresponding channel of the current color object will be left untouched.
aCol | The color to use for initial add. |
dCol | The color to use for final division. |
Definition at line 2159 of file MRcolorTpl.hpp.
|
inline |
Computes the arithmetic difference of the given color from the current one.
aCol | The color to use in the computation. |
Definition at line 2170 of file MRcolorTpl.hpp.
|
inline |
Computes the arithmetic modulus of the current by the given one.
If a channel of aCol is zero, then the corresponding channel of the current object is left untouched.
aCol | The color to use in the computation. |
Definition at line 2180 of file MRcolorTpl.hpp.
|
inline |
Template specialization member function differing from the above function only in supported template conditions.
Definition at line 2188 of file MRcolorTpl.hpp.
|
inline |
Transforms the color: r=maxChanVal-r, g=maxChanVal-r, and b=maxChanVal-b.
Definition at line 2196 of file MRcolorTpl.hpp.
|
inline |
Power: c=maxChanVal*(c/maxChanVal)^p.
Floating point Numbers are used for intermediate values and the result cast to a colorChanType at the end.
Definition at line 2213 of file MRcolorTpl.hpp.
|
inline |
Adds 1.0 and takes the natural logarithm of each channel.
Floating point Numbers are used for intermediate values and the result cast to a colorChanType at the end.
Definition at line 2222 of file MRcolorTpl.hpp.
|
inline |
Computes ln(c)*scale for each channel value c.
If c==0, then the value is left undisturbed. For floating point images, large negative values will result for channel values <1. For this reason, tfrmLn1() is normally more appropriate for images with floating point channels. Floating point Numbers are used for intermediate values and the result cast to a colorChanType at the end.
scale | The scale value to multiply by the final result. |
Definition at line 2234 of file MRcolorTpl.hpp.
|
inline |
Linearly interpolate between the current color and the given color (at a point scaled the unit interval).
If aDouble is 0, then the current color will not change. If aDouble is 1, then the current color will be tooCol.
aDouble | Distance from the current color (on a unit interval) |
tooCol | The color we are interpolating with. |
Definition at line 2249 of file MRcolorTpl.hpp.
|
inline |
Copies the given argument into the current color object.
Scan as copy() – just with a name more suited to transformation code.
Definition at line 2259 of file MRcolorTpl.hpp.
|
inline |
Makes the current color the maximum of the current color or the given color.
Colors are ordered by intensity (thus the 'I' in the name)
aCol | The color to use in the computation. |
Definition at line 2265 of file MRcolorTpl.hpp.
|
inline |
Makes the current color the minimum of the current color or the given color.
Colors are ordered by intensity (thus the 'I' in the name)
aCol | The color to use in the computation. |
Definition at line 2281 of file MRcolorTpl.hpp.
|
inline |
Makes each component of the current color the maximum of that component and the corresponding component of the given color.
aCol | The color to use in the computation. |
Definition at line 2297 of file MRcolorTpl.hpp.
|
inline |
Makes each component of the current color the minimum of that component and the corresponding component of the given color.
aCol | The color to use in the computation. |
Definition at line 2307 of file MRcolorTpl.hpp.
|
inline |
The Shift Left Transform modifies the current color.
aCol | Number of bits to shift left |
Definition at line 2317 of file MRcolorTpl.hpp.
|
inline |
Template specialization member function differing from the above function only in supported template conditions.
Definition at line 2325 of file MRcolorTpl.hpp.
|
inline |
The Shift Right Transform modifies the current color.
aCol | How many bits to shift. |
Definition at line 2336 of file MRcolorTpl.hpp.
|
inline |
Template specialization member function differing from the above function only in supported template conditions.
Definition at line 2344 of file MRcolorTpl.hpp.
|
inline |
The Saw Transform modifies the current color: C_i = ifelse(ra<=C_i<=rb, C_i, 0)
lowCol | lower cutoff value |
highCol | upper cutoff value |
Definition at line 2355 of file MRcolorTpl.hpp.
|
inline |
The Saw Transform modifies the current color: C_i = ifelse(ra<=C_i<=rb, maxChanVal, 0)
lowCol | lower cutoff value |
highCol | upper cutoff value |
Definition at line 2365 of file MRcolorTpl.hpp.
|
inline |
The DiracTot (total) Transform modifies the current color: Set current color to white if it equals aCol, and black otherwise.
aCol | Dirac trigger value |
Definition at line 2374 of file MRcolorTpl.hpp.
|
inline |
The Dirac Transform modifies the current color: C_i = ifelse(C_i==aCol.C_i, maxChanVal, 0)
aCol | Dirac trigger value |
Definition at line 2384 of file MRcolorTpl.hpp.
|
inline |
The Fuzzy Dirac Transform modifies the current color: C_i=ifelse(|R-ctrCol.R|<=radCol.R), maxChanVal, 0)
ctrCol | Center Color |
radCol | Radius Color |
Definition at line 2394 of file MRcolorTpl.hpp.
|
inline |
Computes the arithmetic mean of the given color and the current one.
aCol | The color to use in the computation. |
Definition at line 2403 of file MRcolorTpl.hpp.
|
inline |
Computes the geometric mean of the given color and the current one.
Floating point Numbers re used for intermediate values and the result cast to a colorChanType at the end.
aCol | The color to use in the computation. |
Definition at line 2413 of file MRcolorTpl.hpp.
|
inline |
Transform the current color by rendering it into a true grey via the same method used by the luminanceRGB() function.
This function only sets the red, blue, and green channels – all other channels are left untouched.
Definition at line 2422 of file MRcolorTpl.hpp.
|
inline |
The 216 Palate Web Safe Transform modifies the current color into the closest web safe color from the 216 color web safe pallet.
This function only sets the red, blue, and green channels – all other channels are left untouched.
Definition at line 2439 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::csWS_tpl< colors >::c().
|
inline |
Compute channels for given color space coordinates for the current color.
Note RGB returns float RGB normalized to 1.0.
space | The color space to convert to |
Definition at line 2465 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::distDeltaE1976(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::distDeltaE1994(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::interplColorSpace().
|
inline |
Compute channels for given color space coordinates for the current color.
Note RGB returns float RGB normalized to 1.0.
space | The color space to stringify |
Definition at line 2564 of file MRcolorTpl.hpp.
|
inline |
The Linear Grey Level Scale transform modifies the current color such that: C_n=c*C_n+b.
This function transforms all channels — not just RGBA.
c | The "contrast" value |
b | The "brightness" value |
Definition at line 2586 of file MRcolorTpl.hpp.
|
inline |
The Linear Grey Level Scale transform modifies the current color such that: R=rc*R+rb, G=gc*G+gb, B=bc*B+bb.
This function ONLY transforms the red, green, and blue channels.
rc | The "contrast" value for red |
rb | The "brightness" value for red |
gc | The "contrast" value for green |
gb | The "brightness" value for green |
bc | The "contrast" value for blue |
bb | The "brightness" value for blue |
Definition at line 2601 of file MRcolorTpl.hpp.
|
inline |
Perform a tfrmLinearGreyLevelScale based on a complex number.
z | The complex number |
cutDepth | Range: \([1, ~30]\) Smaller means more contrast on cuts. |
argCuts | Number of grey cuts for arg |
absCuts | Number of grey cuts for abs |
logAbs | If true, then take the logorithm of abs for cuts. |
Definition at line 2615 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::cs2dFltPalArg< colorScheme, argWrap, cutDepth, argCuts, absCuts, logAbs >::c(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::cs2dIdxPalArg< colorScheme, argWrap, cutDepth, argCuts, absCuts, logAbs >::c(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::cs2dRichardson< cutDepth, argCuts, absCuts, logAbs >::c(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::cs2dThaller_tpl< useHSL, maxV, cutDepth, argCuts, absCuts, logAbs >::c().
|
inline |
The Standard Power Transform modifies the current color such that: C_i = maxChanVal*(C_i / maxChanVal)**p.
Definition at line 2635 of file MRcolorTpl.hpp.
|
inline |
The Standard Power Transform modifies the current color such that: R=maxChanVal*(R/maxChanVal)**rp, B=maxChanVal*(B/maxChanVal)**gp, B=maxChanVal*(B/maxChanVal)**bp.
Definition at line 2644 of file MRcolorTpl.hpp.
|
inline |
The Standard Power Transform with p=2.
The new color will be: C_i = C_i * C_i / maxChanVal == (C_i/maxChanVal)^2*maxChanVal This computation is done with integer math if clrChanT is integral.
Definition at line 2655 of file MRcolorTpl.hpp.
|
inline |
The Standard Power Transform with p=1/2.
The new color will be: C_i = sqrt(C_i / maxChanVal) * maxChanVal
Definition at line 2664 of file MRcolorTpl.hpp.
|
inline |
Use the R, G, & B channels to compute a floating point value representing a grey scale.
What is returned is the dot product of the given color and the three scalars: R*redWt+G*greenWt+B*blueWt.
redWt | The red weight |
greenWt | The green weight |
blueWt | The blue weight |
Definition at line 2683 of file MRcolorTpl.hpp.
|
inline |
Compute the luminance of the current color via the definition given in the ITU-R Recommendation BT.709.
The output value will be between 0 and 1, and is given by: (RGBluminanceWeightR*R+RGBluminanceWeightG*G+RGBluminanceWeightB*B)/maxChanVal.
Definition at line 2695 of file MRcolorTpl.hpp.
|
inline |
Compute the unscaled intensity (sum of the R, G, & B components) of the current color.
Definition at line 2704 of file MRcolorTpl.hpp.
|
inline |
Compute the sum of the components.
Definition at line 2713 of file MRcolorTpl.hpp.
|
inline |
Compute the scaled intensity (sum of the first three components divided by the maximum intensity possible) of the current color.
Definition at line 2722 of file MRcolorTpl.hpp.
|
inline |
Compute the scaled intensity (sum of the components divided by the maximum intensity possible) of the current color.
Definition at line 2728 of file MRcolorTpl.hpp.
|
inline |
Returns the value of the largest component.
Definition at line 2734 of file MRcolorTpl.hpp.
|
inline |
Returns the value of the smallest component.
Definition at line 2757 of file MRcolorTpl.hpp.
|
inline |
Returns the value of the largest component from R, G, and B.
This function is highly optimized.
Definition at line 2777 of file MRcolorTpl.hpp.
|
inline |
Returns the value of the smallest component from R, G, and B.
This function is highly optimized.
Definition at line 2781 of file MRcolorTpl.hpp.
|
inline |
Compute the dot product between the current color and the given color.
i.e. c1.r*c2.r+c1.g*c2.g+...
aColor | the given color |
Definition at line 2786 of file MRcolorTpl.hpp.
|
inline |
Distance between current color and given one (sum squares of channel differences – Euclidean distance squared).
aColor | The given color |
Definition at line 2796 of file MRcolorTpl.hpp.
|
inline |
Distance between current color and given one (sum of absolute channel differences).
aColor | the given color |
Definition at line 2807 of file MRcolorTpl.hpp.
|
inline |
Distance between current color and given one (maximum of absolute value of channel differences).
aColor | the given color |
Definition at line 2817 of file MRcolorTpl.hpp.
|
inline |
LAB Delta E* distance between current color and given one.
Note: The Delta E* 1976 distance measurement is inherently an RGB measurement in that the colors are converted to LAB* as part of the computation.
aColor | the given color |
Definition at line 2831 of file MRcolorTpl.hpp.
References mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getChanNC(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::rgb2colorSpace().
|
inline |
LAB Delta E* 1994 (graphic arts) distance between current color and given one.
Note: The Delta E* 1994 distance measurement is inherently an RGB measurement in that the colors are converted to LAB* as part of the computation. Note: The Delta E* 1994 distance measurement is NOT symetric – the 1976 one is!
aColor | the given color |
Definition at line 2846 of file MRcolorTpl.hpp.
References mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getC0(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getC1(), mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::getC2(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::rgb2colorSpace().
|
inline |
Returns non-zero if the current color is close to aColor (the maximum delta between any two channels is less than or equal to epsilon).
Note the implications for floating point clrChanT.
Definition at line 2873 of file MRcolorTpl.hpp.
|
inline |
Like isClose(), but only checks the R, G, & B channels.
Definition at line 2882 of file MRcolorTpl.hpp.
|
inline |
Returns non-zero if the current color is precicely equal to aColor.
Note the implications for floating point clrChanT.
Definition at line 2892 of file MRcolorTpl.hpp.
|
inline |
Like isEqual(), but only checks the R, G, & B channels.
Definition at line 2904 of file MRcolorTpl.hpp.
|
inline |
Returns non-zero if the given color is logically NOT the same as the current color.
Note the implications for floating point clrChanT.
Definition at line 2914 of file MRcolorTpl.hpp.
Referenced by mjr::operator!=().
|
inline |
Returns non-zero if the given color is black (all componnets are zero)
Definition at line 2918 of file MRcolorTpl.hpp.
|
inline |
LIke isBlack(), but only checks the R, G, & B channels.
Definition at line 2930 of file MRcolorTpl.hpp.
|
inline |
Clamp a value to (infinity, maxChanVal].
Input values larger than maxChanVal are mapped to maxChanVal. Values less than minChanVal are not changed.
arithValue | The value to clamp |
Definition at line 2942 of file MRcolorTpl.hpp.
|
inline |
Clamp a value to [minChanVal, infinity).
arithValue | The value to clamp |
Definition at line 2953 of file MRcolorTpl.hpp.
|
inline |
Clamp a value to [minChanVal, maxChanVal].
arithValue | The value to clamp |
Definition at line 2964 of file MRcolorTpl.hpp.
|
inline |
Definition at line 5124 of file MRcolorTpl.hpp.
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::cs2dFltPalArg< colorScheme, argWrap, cutDepth, argCuts, absCuts, logAbs >::c(), and mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::cs2dIdxPalArg< colorScheme, argWrap, cutDepth, argCuts, absCuts, logAbs >::c().
|
inline |
Definition at line 5125 of file MRcolorTpl.hpp.
maskType mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::theInt |
Definition at line 364 of file MRcolorTpl.hpp.
clrChanT mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::thePartsA[numChan] |
union { ... } mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::theColor |
Holds the color channel data.
The union is used to overlay a mask integer leading to dramatic performance improvements for common color types.
Technically we are not allowed to use a union the way we do in colorTpl with modern C++; however, every compiler I use allows us to access "non-active" union members the same way we did with good old C. At some point C++ compilers will have bit_cast, and I can try doing this the "correct" way with modern C++; however, I'll need to do quite a bit of performance testing first...
Referenced by mjr::colorTpl< clrChanT, numChan, redChanIdx, greenChanIdx, blueChanIdx, alphaChanIdx >::colorTpl().
|
staticconstexpr |
Definition at line 508 of file MRcolorTpl.hpp.
|
staticconstexpr |
Definition at line 509 of file MRcolorTpl.hpp.
|
staticconstexpr |
Definition at line 510 of file MRcolorTpl.hpp.
|
staticconstexpr |
Definition at line 511 of file MRcolorTpl.hpp.
|
staticconstexpr |
Definition at line 512 of file MRcolorTpl.hpp.
|
staticconstexpr |
Number of bits in clrChanT.
Definition at line 518 of file MRcolorTpl.hpp.
|
staticconstexpr |
Number of color data bits.
Definition at line 519 of file MRcolorTpl.hpp.
|
staticconstexpr |
clrChanT is an integral type
Definition at line 520 of file MRcolorTpl.hpp.
|
staticconstexpr |
clrChanT is a floating pint type
Definition at line 521 of file MRcolorTpl.hpp.
|
staticconstexpr |
clrChanT is an unsigned integral type
Definition at line 522 of file MRcolorTpl.hpp.
|
staticconstexpr |
is clrChanT an 8-bit unsigned int?
Definition at line 523 of file MRcolorTpl.hpp.
|
staticconstexpr |
is clrChanT a double?
Definition at line 524 of file MRcolorTpl.hpp.
|
staticconstexpr |
maskType is big enough
Definition at line 525 of file MRcolorTpl.hpp.
|
staticconstexpr |
maskType is perfectly sized
Definition at line 526 of file MRcolorTpl.hpp.
|
staticconstexpr |
channelArithDType is big enough
Definition at line 527 of file MRcolorTpl.hpp.
|
staticconstexpr |
channelArithSPType is big enough
Definition at line 528 of file MRcolorTpl.hpp.
|
staticconstexpr |
channelArithSDPType is big enough
Definition at line 529 of file MRcolorTpl.hpp.
|
staticconstexpr |
channelArithFltType is big enough
Definition at line 530 of file MRcolorTpl.hpp.
|
staticconstexpr |
channelArithLogType is the right size
Definition at line 531 of file MRcolorTpl.hpp.
|
staticconstexpr |
Size of this object.
Definition at line 532 of file MRcolorTpl.hpp.
|
staticconstexpr |
This object smaller than a pointer.
Definition at line 533 of file MRcolorTpl.hpp.
|
staticconstexpr |
maximum value for a channel
Definition at line 534 of file MRcolorTpl.hpp.
|
staticconstexpr |
maximum value for a channel
Definition at line 535 of file MRcolorTpl.hpp.
|
staticconstexpr |
middle value for a channel
Definition at line 536 of file MRcolorTpl.hpp.
|
staticconstexpr |
mask value all ones
Definition at line 537 of file MRcolorTpl.hpp.
|
staticconstexpr |
mask value all zeros
Definition at line 538 of file MRcolorTpl.hpp.
|
staticconstexpr |
Number of channels.
Definition at line 539 of file MRcolorTpl.hpp.
|
staticconstexpr |
Finite "steps" for a color scheme: [0, chanStepMax].
Definition at line 576 of file MRcolorTpl.hpp.
|
staticconstexpr |
Minimum wavelength for wavelength conversion.
Definition at line 577 of file MRcolorTpl.hpp.
|
staticconstexpr |
Maximum wavelength for wavelength conversion.
Definition at line 578 of file MRcolorTpl.hpp.
|
staticconstexpr |
Definition at line 583 of file MRcolorTpl.hpp.
|
staticconstexpr |
Definition at line 584 of file MRcolorTpl.hpp.
|
staticconstexpr |
Definition at line 585 of file MRcolorTpl.hpp.