Flags for the L_ApplyMathLogicBitmap Function

The following flags indicate the channel that will be used:

Value

Meaning

CHANNEL_MASTER

[0x00000000] All channels.

CHANNEL_RED

[0x00000001] Red channel only.

CHANNEL_GREEN

[0x00000002] Green channel only.

CHANNEL_BLUE

[0x00000003] Blue channel only.

The following flags indicate how to treat the color value:

Value

Meaning

AML_VALUE_NOP

[0x00000000] No change.

AML_VALUE_NOT

[0x00000010] Invert the color, resulting in its complement.

AML_VALUE_0

[0x00000020] Change all bits to 0.

AML_VALUE_1

[0x00000030] Change all bits to 1.

The following flags indicate the mathematical operation to use. The operations are performed between each component (R, G and B) and nFactor:

Value

Meaning

AML_OP_AND

[0x00000000] Combine each pixel component value and nFactor using a bitwise AND (&).

 

(pixel = pixel & nFactor)

AML_OP_OR

[0x00000100] Combine each pixel component value and nFactor using a bitwise OR (|).

 

(pixel = pixel | nFactor)

AML_OP_XOR

[0x00000200] Combine each pixel component value and nFactor using a bitwise XOR (^).

 

(pixel = pixel ^ nFactor)

AML_OP_ADD

[0x00000300] Add pixel component value to the nFactor clamping the result to the maximum allowed pixel value.

 

(pixel = min(pixel + nFactor, MAX_PIXEL_VALUE) )

AML_OP_SUBFACT

[0x00000400] Subtract each pixel component value from the nFactor, clamping the result to the allowed pixel range.

 

(pixel = min(max(nFactor - pixel, MIN_PIXEL_VALUE), MAX_PIXEL_VALUE) )

AML_OP_SUBVALUE

[0x00000500] Subtract nFactor from each pixel component value, clamping the result to the allowed pixel range

 

(pixel = min(max(pixel – nFactor), MIN_PIXEL_VALUE, MAX_PIXEL_VALUE) )

AML_OP_ABSDIF

[0x00000600] Calculate the absolute difference between nFactor and each pixel component value.

 

(pixel = abs(pixel – nFactor))

AML_OP_MUL

[0x00000700] Multiply each pixel component value by nFactor/100.

 

(pixel = pixel * nFactor / 100)

AML_OP_DIVFACT

[0x00000800] Divide each pixel component value by nFactor/100. An error will be returned if nFactor = 0.

 

(pixel = pixel * 100 / nFactor)

AML_OP_DIVVALUE

[0x00000900] Divide nFactor by each pixel values. If the pixel values are 0, the result set to maximum allowed pixel value. (pixel = pixel ? min(nFactor / pixel, MAX_PIXEL_VALUE) : MAX_PIXEL_VALUE)

AML_OP_AVG

[0x00000A00] Use the average of the each pixel component value and nFactor. (pixel = (pixel+nFactor) / 2).

AML_OP_MIN

[0x00000B00] Use the lesser of the pixel component values and nFactor:

 

(pixel = min(pixel, nFactor) )

AML_OP_MAX

[0x00000C00] Use the greater of the pixel component values and nFactor:

 

(pixel = max(pixel, nFactor) )

The way MIN_PIXEL_VALUE and MAX_PIXEL_VALUE are calculated depends on the bits per pixel and whether the bitmap is signed or unsigned:

if bitmap is unsigned (most common):

MAX_PIXEL_VALUE will be : 255 (8-bit), 4095 (12-bit) or 65535 (16-bit)

MIN_PIXEL_VALUE = 0

if the bitmap is signed (rare case):

MAX_PIXEL_VALUE will be : 127 (8-bit), 2047 (12-bit) or 32767 (16-bit)

MIN_PIXEL_VALUE will be -128 (8-bit), -2048 (12-bit) or -32768 (16-bit)

The following flags indicate how to treat the output value:

Value

Meaning

AML_RES_NOP

[0x00000000] No change.

AML_RES_NOT

[0x00001000] Invert the color, resulting in its complement.

AML_RES_0

[0x00002000] Change all bits to 0.

AML_RES_1

[0x00003000] Change all bits to 1.

If the uFlags is AML_OP_AND, AML_OP_OR, AML_OP_XOR, AML_OP_ADD, AML_OP_MIN, AML_OP_MUL, AML_OP_MAX, AML_OP_DIVVALUE , or AML_OP_SUBVALUE, the valid range of nFactor is:

From MIN_PIXEL_VALUE to MAX_PIXEL_VALUE.

For uFlags equal to AML_OP_SUBFACT, AML_OP_DIF, AML_OP_AVG, the valid range of nFactor is:

From 2 * MIN_PIXEL_VALUE to 2 * MAX_PIXEL_VALUE.