Working with Graphics Devices (Windows Embedded CE 6.0)

1/6/2010

Applications send output to a specified device by creating a device context (DC) for the device. The device context is a structure containing information about the device. Use a DC to store, retrieve, and modify the attributes of graphic objects and to specify graphic modes.

A DC also contains the attributes that determine how DirectDraw interacts with a device. These attributes eliminate the need to specify every piece of information Windows Embedded CE requires to display an object on a device. If you want to change an attribute, you can use attribute functions to change current device settings.

To create a DC, call a device context function, which then returns a device context handle that identifies the device.

To create a memory DC, call the CreateCompatibleDC function.

To create a DirectDraw surface DC, call the IDirectDrawSurface::GetDC function.

After you have the DC, you can manipulate it with the SelectObject function and examine its current settings with the GetObject and GetCurrentObject functions.

The following table shows the DCs supported by Windows Embedded CE.

Device context Description

Memory

Supports text and bitmap drawing operations. The DC is obtained by calling the CreateCompatibleDC function.

DirectDraw surface

Supports text and bitmap operations on DirectDraw surfaces. The DC is obtained by calling the IDirectDrawSurface::GetDC method.

The following table shows the modes that control text display, such as how colors are mixed on the screen.

Graphics mode Description

Background

Defines how background colors are mixed with screen colors.

Foreground and background colors

Defines how foreground and background colors are used for text output.

Note

Windows Embedded CE maps logical coordinates to physical coordinates in a 1:1 ratio from left to right and top to bottom.

See Also

Concepts

Memory Device Contexts
Graphic Objects and Modes
Working with DirectDraw Surfaces

Other Resources

DirectDraw Application Development