MGL_beginPaint

Associate a window manager device context with an MGL device context.

Declaration

ibool MGLAPI MGL_beginPaint(
MGLDC *dc,
MGL_HDC hdc)

Prototype In

mglwin.h

Parameters

dc | MGL windowed device context to use
hdc | Handle to window manager device context to associate

Return Value

True if the application's palette has changed, false if not.

Description

This function and its and the corresponding function MGL_endPaint() should be called between the windows BeginPaint and EndPaint messages. This function allows MGL to use the newest clipping regions and viewport settings.

MGL_beginPaint() and MGL_endPaint() must bracket drawing functions that draw to a window type with a style of CS_PARENTDC or CS_CLASSDC. Such as dialog box controls. These types of windows allocate device handles on the fly so the HDC may change between calls to GetDC() or BeginPaint(). Therefore MGL cannot draw to these types of windows without knowing the new HDC after every BeginPaint() or GetDC() call.

OpenGL windows should NOT use MGL_beginPaint and MGL_endPaint.

A typical Windows WM_PAINT handler would be coded as follows:

case WM_PAINT:
hdc = BeginPaint(hwnd,&ps);
MGL_beginPaint(dc,hdc);
// Do rasterizing code in here //
MGL_bitBlt(dc,memDC,r,0,0,MGL_REPLACE_MODE);
MGL_endPaint(dc);
EndPaint(hwnd,&ps);
return 0;

See Also

MGL_EndPaint

Copyright © 2002 SciTech Software, Inc. Visit our web site at http://www.scitechsoft.com