Flags for the ApplyMathLogic method
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 iFactor:
Value |
Meaning |
AML_OP_AND |
[0x00000000] Combine each pixel component value and iFactor using a bitwise AND (&). |
|
(pixel = pixel & iFactor) |
AML_OP_OR |
[0x00000100] Combine each pixel component value and iFactor using a bitwise OR (|). |
|
(pixel = pixel | iFactor) |
AML_OP_XOR |
[0x00000200] Combine each pixel component value and iFactor using a bitwise XOR (^). |
|
(pixel = pixel ^ iFactor) |
AML_OP_ADD |
[0x00000300] Add pixel component value to the iFactor clamping the result to the maximum allowed pixel value. |
|
(pixel = min(pixel + iFactor, MAX_PIXEL_VALUE) ) |
AML_OP_SUBFACT |
[0x00000400] Subtract each pixel component value from the iFactor, clamping the result to the allowed pixel range. |
|
(pixel = min(max(iFactor - pixel, MIN_PIXEL_VALUE), MAX_PIXEL_VALUE) ) |
AML_OP_SUBVALUE |
[0x00000500] Subtract iFactor from each pixel component value, clamping the result to the allowed pixel range |
|
(pixel = min(max(pixel – iFactor), MIN_PIXEL_VALUE, MAX_PIXEL_VALUE) ) |
AML_OP_ABSDIF |
[0x00000600] Calculate the absolute difference between iFactor and each pixel component value. |
|
(pixel = abs(pixel – iFactor)) |
AML_OP_MUL |
[0x00000700] Multiply each pixel component value by nFactor/100. |
|
(pixel = pixel * iFactor / 100) |
AML_OP_DIVFACT |
[0x00000800] Divide each pixel component value by nFactor/100. An error will be returned if iFactor = 0. |
|
(pixel = pixel * 100 / iFactor) |
AML_OP_DIVVALUE |
[0x00000900] Divide iFactor by each pixel values. If the pixel values are 0, the result set to maximum allowed pixel value. (pixel = pixel ? min(iFactor / pixel, MAX_PIXEL_VALUE) : MAX_PIXEL_VALUE) |
AML_OP_AVG |
[0x00000A00] Use the average of the each pixel component value and iFactor. |
|
(pixel = (pixel+iFactor) / 2). |
AML_OP_MIN |
[0x00000B00] Use the lesser of the pixel component values and iFactor: |
|
(pixel = min(pixel, iFactor) ) |
AML_OP_MAX |
[0x00000C00] Use the greater of the pixel component values and iFactor: |
|
(pixel = max(pixel, iFactor) ) |
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 lFlags 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 iFactor 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 iFactor is:
From 2 * MIN_PIXEL_VALUE to 2 * MAX_PIXEL_VALUE.