OP_ZOOM: DIB zoom/shrink, gray scale, halftone
The OP_ZOOM opcode operates on 8-bit and 24-bit input DIBs creating 1-bit halftone, 8-bit gray scale or 24-bit color output DIBs possibly changed in width and/or height. An 8-bit input DIB can be color or gray scale.
The bit-depth and color characteristics of the output DIB is determined as follows:
- If NewBitCount is 1, then the output is 1-bit halftone (dithered monochrome).
- Otherwise if PF_ConvertGray is set, then the output is 8-bit gray scale.
- Otherwise the output is 24-bit color (although if the input is gray scale, then all of the output colors will be gray).
The dimensions of the output DIB are determined according to the u.ZOOM.Mode field. If it is 0, then the new image width and height will be u.ZOOM.NewWidth and u.ZOOM.NewHeight. Otherwise the new image width will be the rounded value of:
Head.biWidth * ( u.ZOOM.NewWidth / u.ZOOM.NewHeight )
and the new image height will be the rounded value of:
Head.biHeight * ( u.ZOOM.NewWidth / u.ZOOM.NewHeight )
See the ZOOM_PARMS structure section for additional information.
Notes
- The input image must be at least 4 pixels wide and 4 lines high.
- The output image width must be at least 1/64th the input image width. The output image height must be at least 1/64th the input image height.
- The Get and Put queues are not used during the REQ_INIT request.
- The Get queue can be allocated during the REQ_EXEC response loop if desired.
- The Put queue can be allocated during the REQ_EXEC response loop if desired. If the Put queue is a linear buffer which is large enough for the entire output image, it must be, or must appear to be, at least one byte larger than is actually needed for the output image in order to avoid all RES_PUT_NEED_SPACE responses.
- In the current implementation, the REQ_INIT request will return RES_DONE or RES_ERR only.
- In the current implementation, RES_PUT_NEED_SPACE will be returned unless the Put queue is at least one byte larger than the size needed for the entire output image.
- In the current implementation, RES_PUT_YIELD is returned even if the PF_YieldPut flag is not specified.