THSLColor Record
Implements a simple representation of a color in Hue/Saturation/Lum colorspace.
Syntax
Unit: FlexCel.Core
THSLColor = record;
Methods
Name | Description |
---|---|
Create | Overloaded Create(TUIColor) Create(TColor) Create(Double, Double, Double) |
ToColor | Returns a system color from this instance. This method is only needed in C++, in Delphi you can just assign the HslColor to the Color:...[more] |
ApplyTint | This method returns the brightness that results from applying tint to brightness. |
GetTint | Returns the tint needed to go from originalBrightness to newBrightness. A tint of 0 means no change (OriginalBrightness == NewBrightness), a tint of -1 means NewBrightness = 0, and a tint of 1 means NewBrightness = 1. So this method just does a simple interpolation to find out the needed tint. This method is the inverse of ApplyTint |
DistanceSquared | Returns the distance between 2 colors. Not that this is not the euclidean distance, but a distance calculated to improve Hue matching. When converting cell colors, we try to preserve hues, so even a very pale red cell will be converted to bright red and not white or a very pale blue. This make it different from standard color matching as is done when adjusting images to a color palette, and where hue is not as important as here. |
Equals | Returns true if both colors are the same. |
GetHashCode | Returns a hashcode for the color. |
CompareTo | Returns -1 if obj is more than color, 0 if both colors are the same, and 1 if obj is less than color. |
Operators
Name | Description |
---|---|
Implicit Conversion | Overloaded Implicit conversion from TUIColor to THSLColor Implicit conversion from THSLColor to TUIColor Implicit conversion from TColor to THSLColor Implicit conversion from THSLColor to TColor |
Equality | Adapts the = operator so it returns true when both instances have the same values. |
Inequality | Adapts the <> operator so it returns true when both instances have different values. |
GreaterThan | Adapts the > operator so it returns true when the first parameter is bigger than the second. |
LessThan | Adapts the < operator so it returns true when the first parameter is smaller than the second. |