Graphics Cursors

To set a new graphics cursor, VMOUSE passes the address of a GRAPHICSCURSOR structure to the cursor VxD's SETGRAPHICSCURSOR function. The cursor VxD sets a new graphics cursor based on the information in the structure.

A graphics cursor is a bitmapped image that moves over the images on the screen. The width and height of the cursor image is expressed in pixels and is defined by the wWidth and wHeight members of the GRAPHICSCURSOR structure.

The pixels in the cursor image interact with the pixels on the display in a manner defined by the screen mask and the cursor mask. The screen mask determines whether the cursor pixels are part of the cursor's shape or part of the background; the cursor mask determines how the pixels under the cursor contribute to the color of the cursor.

To create the cursor, a cursor VxD operates on the bits in the computer's video memory that correspond to the image under the cursor. First, the VxD must expand each bit in the screen and cursor masks to match the number of bits in video memory required for each screen pixel's color information. Next, the VxD does a logical AND operation between the expanded screen-mask bits and the color-information bits. The color of the pixels under the cursor remains unchanged wherever a screen-mask bit is 1 and changes wherever the screen-mask bit is 0. Finally, the VxD does a logical XOR operation between the pixel bits and the expanded bits from the cursor mask. Where the cursor mask is 0, the screen pixels are unchanged. Where the mask is 1, the color of the pixels is inverted.

The dwOffset32Masks member of the GRAPHICSCURSOR structure specifies the offset from the beginning of the structure to the screen and cursor masks. The cursor mask must follow the screen mask.

A graphics cursor must have a hot spot, a single pixel in the cursor used to identify the cursor's location on the screen. The wHotX and wHotY members of GRAPHICSCURSOR define the coordinates of the hot spot relative to the upper-left corner of the cursor bitmasks.

See also GRAPHICSCURSOR, SETGRAPHICSCURSOR