If COM_TRANSFORM is set, the current position is expected in world coordinates. If COM_TRANSFORM is not set, the current position is expected in screen coordinates. The new line style is stored in the DC instance data structure. Some lines and curves can be drawn either by the presentation driver or by simulations, and therefore must be able to query and set the style as required.
The high-order WORD of the style number contains the first/last pel information. The low-order BYTE indicates the position in the style mask. The next byte is the state of the style error value. Refer to GreGetLineOrigin for further information.
The following C Language example outlines a strategy by which the handling routine could use the information from a call to GreSetLineOrigin.
/******************************************************************/ /* */ /* StyleMask is a single byte. usState is a USHORT with the */ /* error byte as the low-order byte and the mask position as */ /* the high-order byte. The three low-order bytes of the mask */ /* position represent the number of bits by which StyleMask has */ /* been rotated. */ /* */ /******************************************************************/ while ( necessary - - ) { / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / / * * / / * Do we need to draw the first pel in the line ? * / / * * / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / if ( stylemask & 0x80 ) SetPel ( x , y ) ; / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / / * * / / * Save the current style state . * / / * * / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / usStateOld = usState ; switch ( LineMajor ) { case yMajor : usState = usState + yRatio ; break ; default : usState = usState + xRatio ; break ; } if HIBYTE ( usState ) ! = HIBYTE ( usStateOld ) / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / / * * / / * If the error byte has overflowed , rotate the style ratio . * / / * The style mask is reset every eighth rotation . * / / * * / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / RotateLeftOne ( StyleRatio ) ; UpDateNext ( x , y ) ; }
The values for pRatio are set and queried by GreSetStyleRatio and GreGetStyleRatio respectively. Alternatively, the programmer can specify device-specific defaults for xRatio and yRatio.