The following example creates a solid brush based on a color that has an alpha component of 128. The code uses that brush to paint two ellipses. The first ellipse is painted with the compositing mode set to
CompositingQualityHighSpeed, and the second ellipse is painted with the compositing mode set to
CompositingQualityHighQuality.
C++
VOID Example_SetSetSmoothingMode(HDC hdc)
{
Graphics graphics(hdc);
// Set the smoothing mode to SmoothingModeHighSpeed, and fill an ellipse.
graphics.SetSmoothingMode(SmoothingModeHighSpeed);
graphics.FillEllipse(&SolidBrush(Color(255, 0, 0, 0)), 0, 0, 200, 100);
// Set the smoothing mode to SmoothingModeHighQuality, and fill an ellipse.
graphics.SetSmoothingMode(SmoothingModeHighQuality);
graphics.FillEllipse(&SolidBrush(Color(255, 0, 0, 0)), 200, 0, 200, 100);
}
PowerBASIC
SUB GDIP_SetSmoothingMode (BYVAL hdc AS DWORD)
LOCAL hStatus AS LONG
LOCAL pGraphics AS DWORD
LOCAL pBrush AS DWORD
hStatus = GdipCreateFromHDC(hdc, pGraphics)
' // Create a SolidBrush object with an alpha-blended color.
hStatus = GdipCreateSolidFill(GDIP_ARGB(255, 0, 0, 0), pBrush)
' // Set the smoothing mode to SmoothingModeHighSpeed, and fill an ellipse.
hStatus = GdipSetSmoothingMode(pGraphics, %SmoothingModeHighSpeed)
hStatus = GdipFillEllipse(pGraphics, pBrush, 0, 0, 200, 100)
' // Set the smoothing mode to SmoothingModeHighSpeed, and fill an ellipse.
hStatus = GdipSetSmoothingMode(pGraphics, %SmoothingModeHighQuality)
hStatus = GdipFillEllipse(pGraphics, pBrush, 200, 0, 200, 100)
' // Cleanup
IF pBrush THEN GdipDeleteBrush(pBrush)
IF pGraphics THEN GdipDeleteGraphics(pGraphics)
END SUB
(http://www.jose.it-berater.org/captures/GdipSetSmoothingMode.png)