CGpGraphics.SetSmoothingModemethod
Sets the rendering quality of the **Graphics** object.
Syntax
FUNCTION SetSmoothingMode (BYVAL smoothingMode AS LONG) AS GpStatus
Parameters
| Name | Description | |
|---|---|---|
smoothingMode | Element of the SmoothingMode enumeration that specifies whether smoothing (antialiasing) is applied to lines and curves. |
Return value
If the function succeeds, it returns StatusOk, which is an element of the GpStatus enumeration.
If the function fails, it returns one of the other elements of the GpStatus enumeration.
Description
Sets the rendering quality of the Graphics object.
Remarks
Smoothing performed by an 8 X 4 box filter gives better results for nearly vertical lines than it does for nearly horizontal lines. Smoothing performed by an 8 X 8 box filter gives equally good results for nearly vertical and nearly horizontal lines. The 8x8 algorithm produces higher quality smoothing but is slower than the 8 X 4 algorithm.
Example
' ======================================================================================== ' The following example sets the smoothing mode to high speed and draws an ellipse. It then ' gets the smoothing mode, changes it to high quality, and draws a second ellipse to ' demonstrate the difference. ' ======================================================================================== SUB Example_SmoothingMode (BYVAL hdc AS HDC)
' // Create a graphics object from the window device context DIM graphics AS CGpGraphics = hdc ' // Set the scale transform graphics.ScaleTransformForDpi
' // Set the smoothing mode to SmoothingModeHighSpeed. graphics.SetSmoothingMode(SmoothingModeHighSpeed)
' // Draw an ellipse. graphics.DrawEllipse(@CGpPen(ARGB_BLACK, 3), 10, 50, 200, 100)
' // Get the smoothing mode. DIM nMode AS SmoothingMode = graphics.GetSmoothingMode
' // Test mode to see whether smoothing has been set for the Graphics object. IF nMode <> SmoothingModeHighQuality THEN
graphics.SetSmoothingMode(SmoothingModeHighQuality)
END IF
' // Draw an ellipse to demonstrate the difference. graphics.DrawEllipse(@CGpPen(ARGB_RED, 3), 220, 50, 200, 100)
END SUB ' ========================================================================================
Reference
- Include file
CGpGraphics.inc - Defined in AfxNova/CGpGraphics.inc:247
- Documented in Graphics/GdiPlus Classes/CGpGraphics Classes.md
- Topic: CGpGraphics Class