MKI_COLORVALUE (API Types) Changed in Version 2014.0

www.CAD6.com

C++ Syntax

typedef DWORD MKI_COLORVALUE;

 

Color values used to describe a color in one of the available color models.

 

Element Description

The data format stored in these 32 bits depends on the chosen color model (see MKI_COLORMODEL):

 

Color Model "RGB"

BValue

[BYTE] The red component is stored in the bits 16 to 23 of the DWORD. Allowed values are 0 to 255. You can use the mki_color_get_rgb_r() macro to access this component.

GValue

[BYTE] The red component is stored in the bits 8 to 15 of the DWORD. Allowed values are 0 to 255. You can use the mki_color_get_rgb_g() macro to access this component.

RValue

[BYTE] The red component is stored in the bits 0 to 7 of the DWORD. Allowed values are 0 to 255. You can use the mki_color_get_rgb_b() macro to access this component.

 

To assemble such an RGB value, you can use the mki_color_make_rgb() macro.

 

Color Model "CMYK"

CValue

[BYTE] The cyan component is stored in the bits 24 to 31 of the DWORD. Allowed values are 0 to 255. You can use the mki_color_get_cmyk_c() macro to access this component.

MValue

[BYTE] The magenta component is stored in the bits 16 to 23 of the DWORD. Allowed values are 0 to 255. You can use the mki_color_get_cmyk_m() macro to access this component.

YValue

[BYTE] The yellow component is stored in the bits 8 to 15 of the DWORD. Allowed values are 0 to 255. You can use the mki_color_get_cmyk_y() macro to access this component.

KValue

[BYTE] The black component is stored in the bits 0 to 7 of the DWORD. Allowed values are 0 to 255. You can use the mki_color_get_cmyk_k() macro to access this component.

 

To assemble such a CMYK value, you can use the mki_color_make_cmyk() macro.

 

Color Model "GRAY"

KValue

[BYTE] The black component is stored in the bits 0 to 7 of the DWORD. Allowed values are 0 to 255. You can use the mki_color_get_gray_k() macro to access this component.

 

To assemble such a GRAY value, you can use the mki_color_make_gray() macro.

 

Color Model "HSB"

HValue

[WORD] The hue component is stored in the bits 16 to 31 of the DWORD. Allowed values are 0 to 360. You can use the mki_color_get_hsb_h() macro to access this component.

SValue

[BYTE] The saturation component is stored in the bits 8 to 15 of the DWORD. Allowed values are 0 to 200. You can use the mki_color_get_hsb_s() macro to access this component.

BValue

[BYTE] The brightness component is stored in the bits 0 to 7 of the DWORD. Allowed values are 0 to 200. You can use the mki_color_get_hsb_b() macro to access this component.

 

To assemble such an HSB value, you can use the mki_color_make_hsb() macro.

 

Color Model "CIElab" Changed in Version 2014.0

LValue

[WORD] The L* component is stored in the bits 22 to 31 of the DWORD. Allowed values are 0 to 500, representing an L value of 0 to 100 in 1/5 steps. You can use the mki_color_get_lab_l() macro to access this component. This macro will convert this value to a double value with a range of 0.0 to 100.0.

AValue

[WORD] The a* component is stored in the bits 11 to 21 of the DWORD. Allowed values are 250 to 1750, representing an a* value of -150 to 150 in 1/5 steps with an offset of 1000. You can use the mki_color_get_lab_a() macro to access this component. This macro will convert this value to a double value with a range of -150.0 to 150.0.

BValue

[WORD] The b* component is stored in the bits 0 to 10 of the DWORD. Allowed values are 250 to 1750, representing a b* value of -150 to 150 in 1/5 steps with an offset of 1000. You can use the mki_color_get_lab_b() macro to access this component. This macro will convert this value to a double value with a range of -150.0 to 150.0.

 

To assemble such a LAB value, you can use the mki_color_make_lab() macro. This macro will automatically convert the double values to WORD-encoded values.

 

MKD Syntax

The syntax depends on the chosen color model which is defined by the first value (see MKI_COLORMODE_). The number and format of the following values depends on the color model:

 

No Color Model

RValue/GValue/BValue

 

In some cases, colors are used without an explicit color model information, e.g. when stating display-dependent colors in the Section =PROFILE= of drawing files. In this case, the RGB100 color model is to be used. The three components of the RGB color model are separated by the character / (Ansi 47). Each component may have floating point values between 0.0 and 1.0 (including).

 

Color Model "RGB100"

0/RValue/GValue/BValue

 

The three components of the RGB color model are separated by the character / (Ansi 47). Each component may have floating point values between 0.0 and 1.0 (including).

 

Color Model "RGB255"

1/RValue/GValue/BValue

 

The three components of the RGB color model are separated by the character / (Ansi 47). Each component may have integer values between 0 and 255 (including).

 

Color Model "CMYK100"

2/CValue/MValue/YValue/KValue

 

The four components of the CMYK color model are separated by the character / (Ansi 47). Each component may have floating point values between 0.0 and 1.0 (including).

 

Color Model "CMYK255"

3/CValue/MValue/YValue/KValue

 

The four components of the CMYK color model are separated by the character / (Ansi 47). Each component may have integer values between 0 and 255 (including).

 

Color Model "GRAY100"

4/KValue

 

The one components of the GRAY color model is separated by the character / (Ansi 47). The component may have floating point values between 0.0 and 1.0 (including).

 

Color Model "GRAY255"

5/KValue

 

The one components of the GRAY color model is separated by the character / (Ansi 47). The component may have integer values between 0 and 255 (including).

 

Color Model "HSB"

6/HValue/SValue/BValue

 

The three components of the HSB color model are separated by the character / (Ansi 47). The first component may have integer values between 0 and 360 (including), the other two components may have floating point values between 0.0 and 1.0 (including).

 

Color Model "CIElab"

7/LValue/AValue/BValue

 

The three components of the LAB color model are separated by the character / (Ansi 47). The first component may have floating point values between 0.0 and 100.0 (including), the second component may have floating point values between -150.0 and 150.0 (including), the third component may have floating point values between -150.0 and 150.0 (including).

 

Please note that values of type double and int may be empty, i.e. the value /// is a correct RGB value, it is equal to 0/0/0/0 or RGB 0/0/0 and represents the color black in the RGB color model! All fractional values will usually be stated without a leading zero, i.e. normally, the color "Gray 50%" will be stored as 4/.5 in the gray color model instead of 4/0.5.

 

Depending on the precision of the creating application, the component values of the examples above might not be exactly reproduced. If each component is stored in a 8 bit field, the value .5 might be exported as .498 or .502 . If no exact color match is needed, the application may round these values to 2 fractional digits. When exporting a color definition value, a format string such as %.3lg should be used to achieve a precision that will allow to handle 8 bit components without errors.

 

Examples for the RGB100 color model

Black

0/0/0/0

White

0/1/1/1

Gray 90%

0/0.1/0.1/0.1

Gray 80%

0/0.2/0.2/0.2

Gray 70%

0/0.3/0.3/0.3

Gray 60%

0/0.4/0.4/0.4

Gray 50%

0/0.5/0.5/0.5

Gray 40%

0/0.6/0.6/0.6

Gray 30%

0/0.7/0.7/0.7

Gray 20%

0/0.8/0.8/0.8

Gray 10%

0/0.9/0.9/0.9

Blue

0/0/0/1

Dark Blue

0/0/0/0.5

Faded Blue

0/0.5/0.5/1

Green

0/0/1/0

Red

0/1/0/0

 

Examples for the CMYK100 color model

Black

2/0/0/0/1

White

2/0/0/0/0

Cyan

2/1/0/0/0

Magenta

2/0/1/0/0

Yellow

2/0/0/1/0

 

CAD6interface 2024.2 - Copyright 2024 Malz++Kassner® GmbH