mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-26 10:19:45 +03:00
Support of CIE Lab and Lch color spaces is introduced in Quantity_Color: - Enumeration Quantity_TypeOfColor is extended by new values representing CIE Lab and Lch color spaces (with D65 2 deg illuminant). - Conversion of RGB color to and from these color spaces is implemented in Quantity_Color class (within existing API). - Color difference calculation using CIE Delta E 200 formula is implemented in method DeltaE2000(). New methods MakeUniformColors() and SetUniformColors() are added in class AIS_ColorScale, generating and setting color scale based on colors of the same lightness in CIE Lch color model. DRAW commands vcolorconvert and vcolordiff are added to perform conversions and compute difference, respectively. A new option -uniform is added in DRAW command vcolorscale, to set uniform color scale. Added test grid v3d colors (color conversions and difference), test bugs vis bug31454 (uniform color scale)
17 lines
551 B
Plaintext
17 lines
551 B
Plaintext
# Check stability of conversion of RGB colors to CIE Lab and Lch
|
|
# color spaces and back on random colors
|
|
|
|
# check color diff on random colors
|
|
for {set i 1} {$i < 1000} {incr i} {
|
|
set rgb "[expr rand()] [expr rand()] [expr rand()]"
|
|
|
|
set lab [vcolorconvert to lab {*}$rgb]
|
|
set lch [vcolorconvert to lch {*}$rgb]
|
|
|
|
set rgb_lab [vcolorconvert from lab {*}$lab]
|
|
set rgb_lch [vcolorconvert from lch {*}$lch]
|
|
|
|
check3reals "RGB ($rgb) to Lab and back" {*}$rgb_lab {*}$rgb 1e-4
|
|
check3reals "RGB ($rgb) to Lch and back" {*}$rgb_lch {*}$rgb 1e-4
|
|
}
|