The SetGraphicsMode function sets the graphics mode for the specified device context.
int SetGraphicsMode(
HDC hdc, |
// handle of the device context |
int iMode |
// graphics mode |
); |
Value |
Meaning |
GM_COMPATIBLE |
Sets the graphics mode that is compatible with Windows version 3.1. This is the default mode. If this value is specified, the application can only modify the world-to-device transform by calling functions that set window and viewport extents and origins, but not by using SetWorldTransform or ModifyWorldTransform; calls to those functions will fail. Examples of functions that set window and viewport extents and origins are SetViewportExtEx and SetWindowExtEx. |
GM_ADVANCED |
Windows NT: Sets the advanced graphics mode that allows world transformations. This value must be specified if the application will set or modify the world transformation for the specified device context. In this mode all graphics, including text output, fully comforms to the world-to-device transformation specified in the device context. Windows 95: The GM_ADVANCED value is not supported. When playing enhanced metafiles, Windows 95 does its best to ensure that enhanced metafiles on Windows 95 look the same as they do on Windows NT. To accomplish this, Windows 95 may simulate GM_ADVANCED mode when playing specific enhanced metafile records. |
If the function succeeds, the return value is the old graphics mode.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
There are three areas in which graphics output differs according to the graphics mode:
In the GM_ADVANCED mode, TrueType (or vector font) text output fully conforms to the world-to-device transform in the device context. The raster fonts only have very limited transformation capabilities (stretching by some integer factors). Graphics device interface (GDI) tries to produce the best output it can with raster fonts for non-trivial transforms.
The GM_ADVANCED graphics mode is required if applications want to draw rectangles that are bottom-right inclusive.
If the GM_ADVANCED graphics mode is set, GDI always draws arcs in the counterclockwise direction in logical space. This is equivalent to the statement that, in the GM_ADVANCED graphics mode, both arc control points and arcs themselves fully respect the device context’s world-to-device transform.
CreateDC, GetArcDirection, GetDC, GetGraphicsMode, ModifyWorldTransform, SetArcDirection, SetViewportExtent, SetViewportExtEx, SetWindowExtent, SetWindowExtEx, SetWorldTransform