Color structure and operations. More...
Classes | |
| struct | KzcColorRGBA |
| Structure of 4-component RGBA color. More... | |
Functions | |
| KZ_INLINE void | kzcColorRGBASet (struct KzcColorRGBA *color, kzFloat red, kzFloat green, kzFloat blue, kzFloat alpha) |
| Sets a value for RGBA color. More... | |
| KZ_INLINE void | kzcColorRGBAScale (struct KzcColorRGBA *color, kzFloat scale) |
| Scales color with given value. More... | |
| KZ_INLINE void | kzcColorRGBACopy (const struct KzcColorRGBA *sourceColor, struct KzcColorRGBA *destinationColor) |
| Copies color to other. More... | |
| KZ_INLINE void | kzcColorRGBAAdd (const struct KzcColorRGBA *colorA, const struct KzcColorRGBA *colorB, struct KzcColorRGBA *destinationColor) |
| Adds color A to color B component-wise. More... | |
| KZ_INLINE void | kzcColorRGBASubtract (const struct KzcColorRGBA *colorA, const struct KzcColorRGBA *colorB, struct KzcColorRGBA *destinationColor) |
| Subtracts color A from color B component-wise. More... | |
| KZ_INLINE void | kzcColorRGBAMultiply (const struct KzcColorRGBA *colorA, const struct KzcColorRGBA *colorB, struct KzcColorRGBA *destinationColor) |
| Multiplies color A by color B component-wise. More... | |
| KZ_INLINE void | kzcColorRGBADivide (const struct KzcColorRGBA *colorA, const struct KzcColorRGBA *colorB, struct KzcColorRGBA *destinationColor) |
| Divides color A by color B component-wise. More... | |
| KZ_INLINE void | kzcColorRGBAModulo (const struct KzcColorRGBA *colorA, const struct KzcColorRGBA *colorB, struct KzcColorRGBA *destinationColor) |
| Finds modulo of division of color A by color B component-wise. More... | |
| KZ_INLINE void | kzcColorRGBAAbs (const struct KzcColorRGBA *color, struct KzcColorRGBA *out_color) |
| Abs of a color. More... | |
| KZ_INLINE void | kzcColorRGBACeil (const struct KzcColorRGBA *color, struct KzcColorRGBA *out_color) |
| Ceil of a color. More... | |
| KZ_INLINE void | kzcColorRGBAFloor (const struct KzcColorRGBA *color, struct KzcColorRGBA *out_color) |
| Floor of a color. More... | |
| KZ_INLINE void | kzcColorRGBARound (const struct KzcColorRGBA *color, struct KzcColorRGBA *out_color) |
| Round of a color. More... | |
| KZ_INLINE void | kzcColorRGBASqrt (const struct KzcColorRGBA *color, struct KzcColorRGBA *out_color) |
| Square root of a color component-wise. More... | |
| KZ_INLINE void | kzcColorRGBAPow (const struct KzcColorRGBA *color, kzFloat exponent, struct KzcColorRGBA *out_color) |
| Raises a color to power of 'exponent' component-wise. More... | |
| KZ_INLINE struct KzcColorRGBA | kzcColorRGBA (kzFloat r, kzFloat g, kzFloat b, kzFloat a) |
| Returns new KzcColorRGBA according to r, g, b, a values. More... | |
| KZ_INLINE struct KzcColorRGBA | kzcColorRGBAMax (const struct KzcColorRGBA *colorA, const struct KzcColorRGBA *colorB) |
| Returns the component maximum of two colors. More... | |
| KZ_INLINE struct KzcColorRGBA | kzcColorRGBAMin (const struct KzcColorRGBA *colorA, const struct KzcColorRGBA *colorB) |
| Returns the component minimum of two colors. More... | |
| KZ_INLINE struct KzcColorRGBA | kzcColorRGBAStep (const struct KzcColorRGBA *colorA, const struct KzcColorRGBA *colorB) |
| Returns the component-wise step() of two colors. More... | |
| kzBool | kzcColorRGBAIsEqual (const struct KzcColorRGBA *color1, const struct KzcColorRGBA *color2) |
| Compares if two colors are equal. More... | |
| void | kzcColorRGBAToHSL (const struct KzcColorRGBA *color, kzFloat *out_hue, kzFloat *out_saturation, kzFloat *out_lightness) |
| Converts RGB color to HSL. More... | |
| struct KzcColorRGBA | kzcColorRGBAFromHSL (kzFloat hue, kzFloat saturation, kzFloat lightness) |
| Converts HSL to RGBA color. More... | |
| struct KzcColorRGBA | kzcColorRGBA (kzUint r, kzUint g, kzUint b) |
| struct KzcColorRGBA | kzcColorRGBABlend (const struct KzcColorRGBA *colorA, const struct KzcColorRGBA *colorB, kzFloat blendValue) |
| Blends 2 colors, blend percentage clamped to [0, 1]. More... | |
| struct KzcColorRGBA | kzcColorRGBAInterpolate (const struct KzcColorRGBA *colorA, const struct KzcColorRGBA *colorB, kzFloat interpolationValue) |
| Interpolates 2 colors, gives an interpolated color. More... | |
| void | kzcColorRGBASetComponent (struct KzcColorRGBA *color, kzUint component, kzFloat value) |
| Sets an individual component by index. More... | |
Color structure and operations.
Copyright 2008-2020 by Rightware. All rights reserved.
| KZ_INLINE void kzcColorRGBASet | ( | struct KzcColorRGBA * | color, |
| kzFloat | red, | ||
| kzFloat | green, | ||
| kzFloat | blue, | ||
| kzFloat | alpha | ||
| ) |
Sets a value for RGBA color.
| KZ_INLINE void kzcColorRGBAScale | ( | struct KzcColorRGBA * | color, |
| kzFloat | scale | ||
| ) |
Scales color with given value.
| KZ_INLINE void kzcColorRGBACopy | ( | const struct KzcColorRGBA * | sourceColor, |
| struct KzcColorRGBA * | destinationColor | ||
| ) |
Copies color to other.
| KZ_INLINE void kzcColorRGBAAdd | ( | const struct KzcColorRGBA * | colorA, |
| const struct KzcColorRGBA * | colorB, | ||
| struct KzcColorRGBA * | destinationColor | ||
| ) |
Adds color A to color B component-wise.
| KZ_INLINE void kzcColorRGBASubtract | ( | const struct KzcColorRGBA * | colorA, |
| const struct KzcColorRGBA * | colorB, | ||
| struct KzcColorRGBA * | destinationColor | ||
| ) |
Subtracts color A from color B component-wise.
| KZ_INLINE void kzcColorRGBAMultiply | ( | const struct KzcColorRGBA * | colorA, |
| const struct KzcColorRGBA * | colorB, | ||
| struct KzcColorRGBA * | destinationColor | ||
| ) |
Multiplies color A by color B component-wise.
| KZ_INLINE void kzcColorRGBADivide | ( | const struct KzcColorRGBA * | colorA, |
| const struct KzcColorRGBA * | colorB, | ||
| struct KzcColorRGBA * | destinationColor | ||
| ) |
Divides color A by color B component-wise.
| KZ_INLINE void kzcColorRGBAModulo | ( | const struct KzcColorRGBA * | colorA, |
| const struct KzcColorRGBA * | colorB, | ||
| struct KzcColorRGBA * | destinationColor | ||
| ) |
Finds modulo of division of color A by color B component-wise.
| KZ_INLINE void kzcColorRGBAAbs | ( | const struct KzcColorRGBA * | color, |
| struct KzcColorRGBA * | out_color | ||
| ) |
Abs of a color.
| KZ_INLINE void kzcColorRGBACeil | ( | const struct KzcColorRGBA * | color, |
| struct KzcColorRGBA * | out_color | ||
| ) |
Ceil of a color.
| KZ_INLINE void kzcColorRGBAFloor | ( | const struct KzcColorRGBA * | color, |
| struct KzcColorRGBA * | out_color | ||
| ) |
Floor of a color.
| KZ_INLINE void kzcColorRGBARound | ( | const struct KzcColorRGBA * | color, |
| struct KzcColorRGBA * | out_color | ||
| ) |
Round of a color.
| KZ_INLINE void kzcColorRGBASqrt | ( | const struct KzcColorRGBA * | color, |
| struct KzcColorRGBA * | out_color | ||
| ) |
Square root of a color component-wise.
| KZ_INLINE void kzcColorRGBAPow | ( | const struct KzcColorRGBA * | color, |
| kzFloat | exponent, | ||
| struct KzcColorRGBA * | out_color | ||
| ) |
Raises a color to power of 'exponent' component-wise.
Returns new KzcColorRGBA according to r, g, b, a values.
| KZ_INLINE struct KzcColorRGBA kzcColorRGBAMax | ( | const struct KzcColorRGBA * | colorA, |
| const struct KzcColorRGBA * | colorB | ||
| ) |
Returns the component maximum of two colors.
| KZ_INLINE struct KzcColorRGBA kzcColorRGBAMin | ( | const struct KzcColorRGBA * | colorA, |
| const struct KzcColorRGBA * | colorB | ||
| ) |
Returns the component minimum of two colors.
| KZ_INLINE struct KzcColorRGBA kzcColorRGBAStep | ( | const struct KzcColorRGBA * | colorA, |
| const struct KzcColorRGBA * | colorB | ||
| ) |
Returns the component-wise step() of two colors.
| kzBool kzcColorRGBAIsEqual | ( | const struct KzcColorRGBA * | color1, |
| const struct KzcColorRGBA * | color2 | ||
| ) |
Compares if two colors are equal.
| void kzcColorRGBAToHSL | ( | const struct KzcColorRGBA * | color, |
| kzFloat * | out_hue, | ||
| kzFloat * | out_saturation, | ||
| kzFloat * | out_lightness | ||
| ) |
Converts RGB color to HSL.
| struct KzcColorRGBA kzcColorRGBAFromHSL | ( | kzFloat | hue, |
| kzFloat | saturation, | ||
| kzFloat | lightness | ||
| ) |
Converts HSL to RGBA color.
Alpha will be 1.0f.
| struct KzcColorRGBA kzcColorRGBA | ( | kzUint | r, |
| kzUint | g, | ||
| kzUint | b | ||
| ) |
| struct KzcColorRGBA kzcColorRGBABlend | ( | const struct KzcColorRGBA * | colorA, |
| const struct KzcColorRGBA * | colorB, | ||
| kzFloat | blendValue | ||
| ) |
Blends 2 colors, blend percentage clamped to [0, 1].
| struct KzcColorRGBA kzcColorRGBAInterpolate | ( | const struct KzcColorRGBA * | colorA, |
| const struct KzcColorRGBA * | colorB, | ||
| kzFloat | interpolationValue | ||
| ) |
Interpolates 2 colors, gives an interpolated color.
This function approaches colorB from colorA by stepping the individual components by interpolationValue. For example: colorA (1.0, 0.5, 0.0, 1.0), colorB (0.0, 1.0, 0.0, 1.0) with interpolationValue of 0.1 gives: result = (1.0 - 0.1, 0.5 + 0.1, 0.0 + 0.0, 1.0 + 0.0) = (0.9, 0.6, 0.0, 0.0).
| void kzcColorRGBASetComponent | ( | struct KzcColorRGBA * | color, |
| kzUint | component, | ||
| kzFloat | value | ||
| ) |
Sets an individual component by index.
Clamps the value to 0-1 range.
| KANZI_API const struct KzcColorRGBA KZC_COLOR_BLACK_TRANSPARENT |
Constant invisible zero color.
| KANZI_API const struct KzcColorRGBA KZC_COLOR_BLACK |
Constant zero color with full alpha.
| KANZI_API const struct KzcColorRGBA KZC_COLOR_DARK_GRAY |
Dark gray color.
| KANZI_API const struct KzcColorRGBA KZC_COLOR_GRAY |
Gray color.
| KANZI_API const struct KzcColorRGBA KZC_COLOR_WHITE |
White color.
| KANZI_API const struct KzcColorRGBA KZC_COLOR_RED |
Red color.
| KANZI_API const struct KzcColorRGBA KZC_COLOR_GREEN |
Green color.
| KANZI_API const struct KzcColorRGBA KZC_COLOR_BLUE |
Blue color.
| KANZI_API const struct KzcColorRGBA KZC_COLOR_YELLOW |
Yellow color.
| KANZI_API const struct KzcColorRGBA KZC_COLOR_ORANGE |
Orange color.
| KANZI_API const struct KzcColorRGBA KZC_COLOR_LIME |
Lime color.
| KANZI_API const struct KzcColorRGBA KZC_COLOR_TEAL |
Teal color.
| KANZI_API const struct KzcColorRGBA KZC_COLOR_PURPLE |
Purple color.
| KANZI_API const struct KzcColorRGBA KZC_COLOR_PINK |
Pink color.
| KANZI_API const struct KzcColorRGBA KZC_COLOR_CYAN |
Cyan color.