Start with the project you created in Low-Level DigitalPaint: Creating a Region.
IDM_PAINTTEST_FILL
static L_VOID OnFill ( HWND hWnd, pPAINTHANDLE pPaint )
{
HDC hDC ;
PAINTSHAPE shape ;
PAINTFILL fill ;
RECT rcShape ;
RECT rcDCExtents ;
// Get device context to draw on
hDC = GetDC ( hWnd ) ;
// Set the required shape properties
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_BORDERWIDTH |
PSF_BORDERCOLOR |
PSF_BACKGROUNDCOLOR ;
shape.nBorderWidth = 10 ;
shape.crBorderColor = RGB ( 255, 0, 0 ) ;
shape.crBackgroundColor = RGB ( 255, 0, 0 ) ;
// Set the new shape properties
L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;
// Set the coordinates with respect to the DC dimensions
SetRect ( &rcShape, 10, 10, 60, 60 ) ;
// Use the current shape properties to draw an ellipse to the DC (hDC)
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;
SetRect ( &rcShape, 100, 10, 150, 60 ) ;
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;
SetRect ( &rcShape, 60, 60, 95, 95 ) ;
L_PntDrawShapeRectangle ( pPaint, hDC, &rcShape ) ;
SetRect ( &rcShape, 10, 100, 60, 150 ) ;
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;
SetRect ( &rcShape, 100, 100, 150, 150 ) ;
L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;
// Get the destination DC dimensions
GetClientRect ( hWnd, &rcDCExtents ) ;
// Set the toolkit user DC extents
L_PntSetDCExtents ( pPaint, &rcDCExtents ) ;
// Set the required fill properties
fill.nSize = sizeof ( PAINTFILL ) ;
fill.dwMask = PFF_STYLE ;
fill.nStyle = PAINT_FILL_STYLE_GRADIENT ;
// Set the new fill properties
L_PntSetProperty ( pPaint, PAINT_GROUP_FILL, &fill ) ;
// Fill the target area
L_PntFillColorReplace ( pPaint, hDC, RGB ( 255, 0, 0 ) ) ;
// Release the device context
ReleaseDC ( hWnd, hDC ) ;
}
Add the following line after the "return 0L ;" of the "case IDM_PAINTTEST_REGION
:" statement:
case IDM_PAINTTEST_FILL:
OnFill ( hWnd, pPaint ) ;
return 0L ;
Compile and run the project by selecting Build->Execute tutorial.exe from the menu.