xtd 0.2.0
Loading...
Searching...
No Matches
xtd::drawing::color_converter Class Referencefinal
Inheritance diagram for xtd::drawing::color_converter:
xtd::static_object

Definition

Converts colors to and from xtd::drawing::color class. This class cannot be inherited.

Converts colors to and from xtd::drawing::color class. This class cannot be inherited.
Definition color_converter.h:24
#define drawing_export_
Define shared library export.
Definition drawing_export.h:13
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.h:37
Inheritance
xtd::static_objectxtd::drawing::image_converter
Namespace
xtd::drawing
Library
xtd.drawing
Examples
graph_control.cpp.

Public Static Methods

static xtd::drawing::color alpha_blend (const xtd::drawing::color &fore_core, const xtd::drawing::color &back_color, double alpha) noexcept
 Returns the weighted average color between the two given colors.
 
static xtd::drawing::color average (const xtd::drawing::color &color1, const xtd::drawing::color &color2, double weight) noexcept
 Returns the weighted average color between the two given colors.
 
static xtd::drawing::color average (const xtd::drawing::color &color1, const xtd::drawing::color &color2, double weight, bool average_alpha) noexcept
 Returns the weighted average color between the two given colors.
 
static xtd::drawing::color bitonal (const drawing::color &color, int32 threshold, const drawing::color &upper_color, const drawing::color &lower_color) noexcept
 Creates a new lower or upper color of the specified color with specified threshold, upper color, and lower color.
 
static xtd::drawing::color brightness (const xtd::drawing::color &color, double percent) noexcept
 Creates a new color with brightness changed of the specified color with specified percent.
 
static xtd::drawing::color color (const xtd::drawing::color &color, const xtd::drawing::color &value, double percent) noexcept
 Create a new color with specified value that will be added/removed from the specified color with specified percent.
 
static xtd::drawing::color color_extraction (const xtd::drawing::color &color, int32 threshold, const drawing::color &extraction_color, const xtd::drawing::color &other_color) noexcept
 Creates a new filtered color from specified color and replaces other color with other specified color.
 
static xtd::drawing::color color_substitution (const xtd::drawing::color &color, int32 threshold, const drawing::color &source_color, const xtd::drawing::color &new_color) noexcept
 Creates a new color where the specified source color is replaced by the new color.
 
static xtd::drawing::color contrast (const xtd::drawing::color &color, double percent) noexcept
 Creates a new contrasting color of the specified color with specified percent factor.
 
static xtd::drawing::color dark (const xtd::drawing::color &color) noexcept
 Creates a new darker color of the specified color with 33% factor.
 
static xtd::drawing::color dark (const xtd::drawing::color &color, double percent) noexcept
 Creates a new darker color of the specified color with specified percent factor.
 
static xtd::drawing::color disabled (const xtd::drawing::color &fore_color, const xtd::drawing::color &back_color) noexcept
 Creates a new disabled color of the specified color with specified reference background color.
 
static xtd::drawing::color disabled (const xtd::drawing::color &fore_color, float brightness) noexcept
 Creates a new disabled color of the specified color with specified brightness.
 
static xtd::drawing::color gamma_correction (const xtd::drawing::color &color, double r, double g, double b) noexcept
 Creates a new gamma corrected color of the specified color with specified r, g, b corrections.
 
static xtd::drawing::color grayscale (const xtd::drawing::color &color) noexcept
 Creates a new gray color of the specified color.
 
static xtd::drawing::color grayscale (const xtd::drawing::color &color, double percent) noexcept
 Creates a new gray color of the specified color with specified percent factor.
 
static xtd::drawing::color hue_rotate (const xtd::drawing::color &color, int angle) noexcept
 Creates a new color with rotated hue of the specified color with specified angle.
 
static xtd::drawing::color invert (const xtd::drawing::color &color) noexcept
 Creates a new inverted color of the specified color.
 
static xtd::drawing::color invert (const xtd::drawing::color &color, double percent) noexcept
 Creates a new inverted color of the specified color with specified percent factor.
 
static xtd::drawing::color light (const xtd::drawing::color &color) noexcept
 Creates a new lighter color of the specified color with 33% factor.
 
static xtd::drawing::color light (const xtd::drawing::color &color, double percent) noexcept
 Creates a new lighter color of the specified color with specified percent factor.
 
static xtd::drawing::color saturate (const xtd::drawing::color &color, double percent) noexcept
 Creates a new color with saturation changed of the specified color.
 
static xtd::drawing::color sepia (const xtd::drawing::color &color) noexcept
 Creates a new sepia color of the specified color.
 
static xtd::drawing::color sepia (const xtd::drawing::color &color, double percent) noexcept
 Creates a new sepia color of the specified color with specified percent factor.
 
static xtd::drawing::color threshold (const xtd::drawing::color &color, int32 threshold) noexcept
 Creates a new black or white color of the specified color with specified threshold.
 

Member Function Documentation

◆ alpha_blend()

static xtd::drawing::color xtd::drawing::color_converter::alpha_blend ( const xtd::drawing::color fore_core,
const xtd::drawing::color back_color,
double  alpha 
)
staticnoexcept

Returns the weighted average color between the two given colors.

Parameters
fore_coreThe foreground color.
back_colorThe background color.
alphaThe alpha factor
Returns
The combined color.
Remarks
The alpha of color1 is conserved.
The red, green and blue values are averages using the following formula:
color = fore_core * (1 - weight) + back_color * weight;
Represents an ARGB (alpha, red, green, blue) color.
Definition color.h:49
Thus, a weight value of 1.0 will return the background color, while a value of 0.0 will return the foreground color.

◆ average() [1/2]

static xtd::drawing::color xtd::drawing::color_converter::average ( const xtd::drawing::color color1,
const xtd::drawing::color color2,
double  weight 
)
staticnoexcept

Returns the weighted average color between the two given colors.

Parameters
color1The first color.
color2The second color.
weightThe weighting factor
Returns
The average color.
Remarks
The alpha of color1 is conserved.
The red, green and blue values are averages using the following formula:
color = color1 * (1 - weight) + color2 * weight;
Thus, a weight value of 1.0 will return the second color, while a value of 0.0 will return the first color.

◆ average() [2/2]

static xtd::drawing::color xtd::drawing::color_converter::average ( const xtd::drawing::color color1,
const xtd::drawing::color color2,
double  weight,
bool  average_alpha 
)
staticnoexcept

Returns the weighted average color between the two given colors.

Parameters
color1The first color.
color2The second color.
weightThe weighting factor
average_alphaif true alpha was compute to; otherwise the alpha result is the alpha of color1
Returns
The average color.
Remarks
The alpha, red, green and blue values are averages using the following formula:
color = color1 * (1 - weight) + color2 * weight;
Thus, a weight value of 1.0 will return the first color, while a value of 0.0 will return the second color.

◆ bitonal()

static xtd::drawing::color xtd::drawing::color_converter::bitonal ( const drawing::color color,
int32  threshold,
const drawing::color upper_color,
const drawing::color lower_color 
)
staticnoexcept

Creates a new lower or upper color of the specified color with specified threshold, upper color, and lower color.

Parameters
colorThe color to threshold.
thresholdThe threshold value (from 0 to 765).
upper_colorThe color used when RGB color is upper the threshold value.
lower_colorThe color used when RGB color is under or equal the threshold value.
Returns
The new color.

◆ brightness()

static xtd::drawing::color xtd::drawing::color_converter::brightness ( const xtd::drawing::color color,
double  percent 
)
staticnoexcept

Creates a new color with brightness changed of the specified color with specified percent.

Parameters
colorThe color to brightness.
percentThe percent factor in % (from 0.0 to 2.0).
Returns
The new color.
Remarks
0.0will make the color completely black.1.0is default and represents the original color. Values over1.0` will provide brighter results.

◆ color()

static xtd::drawing::color xtd::drawing::color_converter::color ( const xtd::drawing::color color,
const xtd::drawing::color value,
double  percent 
)
staticnoexcept

Create a new color with specified value that will be added/removed from the specified color with specified percent.

Parameters
colorThe color to update.
valueThe value to add / remove
percentThe percent factor in % (from 0.0 to 2.0).
Returns
The new color.

◆ color_extraction()

static xtd::drawing::color xtd::drawing::color_converter::color_extraction ( const xtd::drawing::color color,
int32  threshold,
const drawing::color extraction_color,
const xtd::drawing::color other_color 
)
staticnoexcept

Creates a new filtered color from specified color and replaces other color with other specified color.

Parameters
colorThe color to filter.
thresholdThe threshold value (from 0 to 765).
extraction_colorThe color to extract.
other_colorThe other color.
Returns
The new color.

◆ color_substitution()

static xtd::drawing::color xtd::drawing::color_converter::color_substitution ( const xtd::drawing::color color,
int32  threshold,
const drawing::color source_color,
const xtd::drawing::color new_color 
)
staticnoexcept

Creates a new color where the specified source color is replaced by the new color.

Parameters
colorThe color to filter.
thresholdThe threshold value (from 0 to 765).
source_colorThe source color.
new_colorThe new color.
Returns
The new color.

◆ contrast()

static xtd::drawing::color xtd::drawing::color_converter::contrast ( const xtd::drawing::color color,
double  percent 
)
staticnoexcept

Creates a new contrasting color of the specified color with specified percent factor.

Parameters
colorThe color to change contrast.
percentThe percent factor in % (from 0.0 to 1.0).
Returns
The new color.
Remarks
Thus, 1.0 returns the original color, while the other values give a contrasting color.

◆ dark() [1/2]

static xtd::drawing::color xtd::drawing::color_converter::dark ( const xtd::drawing::color color)
staticnoexcept

Creates a new darker color of the specified color with 33% factor.

Parameters
colorThe color to dark.
Returns
The new color.

◆ dark() [2/2]

static xtd::drawing::color xtd::drawing::color_converter::dark ( const xtd::drawing::color color,
double  percent 
)
staticnoexcept

Creates a new darker color of the specified color with specified percent factor.

Parameters
colorThe color to dark.
percentThe darker factor in % (from 0.0 to 1.0).
Returns
The new color.
Remarks
Thus, a percent value of 1.0 will return the xtd::drawing::color::black, while a value of 0.0 will return the color.

◆ disabled() [1/2]

static xtd::drawing::color xtd::drawing::color_converter::disabled ( const xtd::drawing::color fore_color,
const xtd::drawing::color back_color 
)
staticnoexcept

Creates a new disabled color of the specified color with specified reference background color.

Parameters
fore_colorThe fore color to disabled.
back_colorThe reference background color.
Returns
The new color.

◆ disabled() [2/2]

static xtd::drawing::color xtd::drawing::color_converter::disabled ( const xtd::drawing::color fore_color,
float  brightness 
)
staticnoexcept

Creates a new disabled color of the specified color with specified brightness.

Parameters
fore_colorThe fore color to disabled.
brightnessThe brightness of the reference backgroung color.
Returns
The new color.

◆ gamma_correction()

static xtd::drawing::color xtd::drawing::color_converter::gamma_correction ( const xtd::drawing::color color,
double  r,
double  g,
double  b 
)
staticnoexcept

Creates a new gamma corrected color of the specified color with specified r, g, b corrections.

Parameters
colorThe color to grayscale.
rThe red correction from 0.1 to 5.
gThe green correction from 0.1 to 5.
bThe blue correction from 0.1 to 5.
Returns
The new color.

◆ grayscale() [1/2]

static xtd::drawing::color xtd::drawing::color_converter::grayscale ( const xtd::drawing::color color)
staticnoexcept

Creates a new gray color of the specified color.

Parameters
colorThe color to grayscale.
Returns
The new color.

◆ grayscale() [2/2]

static xtd::drawing::color xtd::drawing::color_converter::grayscale ( const xtd::drawing::color color,
double  percent 
)
staticnoexcept

Creates a new gray color of the specified color with specified percent factor.

Parameters
colorThe color to grayscale.
percentThe percent factor.
Returns
The new color.
Remarks
Thus, 1.0 will make the color completely gray, while 0.0 return the original color.

◆ hue_rotate()

static xtd::drawing::color xtd::drawing::color_converter::hue_rotate ( const xtd::drawing::color color,
int  angle 
)
staticnoexcept

Creates a new color with rotated hue of the specified color with specified angle.

Parameters
colorThe color to rotate hue.
angleThe angle in degrees (form 0 to 360).
Returns
The new color.

◆ invert() [1/2]

static xtd::drawing::color xtd::drawing::color_converter::invert ( const xtd::drawing::color color)
staticnoexcept

Creates a new inverted color of the specified color.

Parameters
colorThe color to invert.
Returns
The new color.

◆ invert() [2/2]

static xtd::drawing::color xtd::drawing::color_converter::invert ( const xtd::drawing::color color,
double  percent 
)
staticnoexcept

Creates a new inverted color of the specified color with specified percent factor.

Parameters
colorThe color to invert.
Returns
The new color.
Remarks
0.0 will represents the original color. 1.0 will provide inverted color.

◆ light() [1/2]

static xtd::drawing::color xtd::drawing::color_converter::light ( const xtd::drawing::color color)
staticnoexcept

Creates a new lighter color of the specified color with 33% factor.

Parameters
colorThe color to light.
Returns
The new color.

◆ light() [2/2]

static xtd::drawing::color xtd::drawing::color_converter::light ( const xtd::drawing::color color,
double  percent 
)
staticnoexcept

Creates a new lighter color of the specified color with specified percent factor.

Parameters
colorThe color to light.
percentThe lighter factor in % (from 0.0 to 1.0).
Returns
The new color.
Remarks
Thus, a percent value of 1.0 will return the xtd::drawing::color::black, while a value of 0.0 will return the color.

◆ saturate()

static xtd::drawing::color xtd::drawing::color_converter::saturate ( const xtd::drawing::color color,
double  percent 
)
staticnoexcept

Creates a new color with saturation changed of the specified color.

Parameters
colorThe color to saturate.
percentThe saturatiob factor in %
Returns
The new result.
Remarks
Thus, 1.0 return the original color. while other will make a saturate color.

◆ sepia() [1/2]

static xtd::drawing::color xtd::drawing::color_converter::sepia ( const xtd::drawing::color color)
staticnoexcept

Creates a new sepia color of the specified color.

Parameters
colorThe color to sepia.
Returns
The new color.

◆ sepia() [2/2]

static xtd::drawing::color xtd::drawing::color_converter::sepia ( const xtd::drawing::color color,
double  percent 
)
staticnoexcept

Creates a new sepia color of the specified color with specified percent factor.

Parameters
colorThe color to sepia.
percentThe percent factor in % (from 0.0 to 1.0).
Returns
The new color.
Remarks
Thus, 1.0 will make the color completely sepia, while 0.0 return the original color.

◆ threshold()

static xtd::drawing::color xtd::drawing::color_converter::threshold ( const xtd::drawing::color color,
int32  threshold 
)
staticnoexcept

Creates a new black or white color of the specified color with specified threshold.

Parameters
colorThe color to threshold.
thresholdThe threshold value (from 0 to 765).
Returns
The new color.

The documentation for this class was generated from the following file: