OP_ADJUST: Adjust Image Color and Lightness
The OP_ADJUST opcode (see opcode specific data structure) provides a mechanism for adjusting the Color, Shadows, and Highlights of an 8-bit grayscale or 24-bit image, in one of two ways: manually or automatically. In manual mode (Method=0 or 1) the user can vary any one or all of the parameters from its default neutral value. The automatic modes are AutoColor (Method=2) and AutoLightness (Method=3). In automatic modes, parameters of corresponding manual algorithms in the u.ADJ structure are filled in with selected default values. Modifications are made to the pixels themselves for both 24bpp images and 8bpp grayscale images.
This operation is performed on a subrectangle of the image if F_Crop is set in PIC_PARM.Flags and the PIC_PARM fields CropXoff, CropYoff, CropWidth, and CropHeight are set. The entire image is analyzed in the automatic modes. Only the selected region is modified and output to the Put Queue.
- Method set to 0 selects manual Color adjustment according to value Color.
- Color is set from 0 to +100 with 0 as the neutral default value.
- Red is set from -100 to +100 with 0 as the neutral default value.
- Green is set from -100 to +100 with 0 as the neutral default value.
- Blue is set from -100 to +100 with 0 as the neutral default value.
- Method set to 1 selects manual Lightness adjustment according to values Shadows and Highlights.
- Shadows is set from 0 to +100 with 0 as the neutral default value.
- Highlights is set from 0 to +100 with 0 as the neutral default value.
- Method set to 2 selects AutoColor. After applying this method field u.ADJ.Color is filled in with automatically selected value.
- Method set to 3 selects AutoLightness. After applying this method fields u.ADJ.Shadows and u.ADJ.Highlights are filled in with automatically selected values.
- Stride is set to the image line width in bytes including padding at the end of the line width or 0. Set Stride to 0 to specify normal 24-bit or 8-bit DIB padding where each image row is padded if necessary to be 32-bit-aligned. Specify no padding by setting PF_NoDibPad in PicFlags and setting Stride to 0.