博客园  :: 首页  :: 联系 :: 管理

GDI+ 消除锯齿的方法

Posted on 2007-04-24 18:52  sunrack  阅读(2380)  评论(0编辑  收藏  举报

Graphics::SetSmoothingMode Method


The SetSmoothingMode method sets the rendering quality of the Graphics object.

Syntax

Status SetSmoothingMode(      

    SmoothingMode smoothingMode );

Parameters

smoothingMode
[in] Element of the SmoothingMode enumeration that specifies whether smoothing (antialiasing) is applied to lines and curves.

Return Value

If the method succeeds, it returns Ok, which is an element of the Status enumeration.

If the method fails, it returns one of the other elements of the Status enumeration.



Remarks

To get the rendering quality for text, use the GetTextRenderingHint method. The higher the level of quality of the smoothing mode, the slower the performance.

Example

The following example sets the smoothing mode to two different values and fills an ellipse to demonstrate each mode.

 

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);
}

Method Information

Stock Implementation gdiplus.dll
Header Declared in Gdiplusgraphics.h, include gdiplus.h
Import library gdiplus.lib
Minimum availability GDI+ 1.0
Minimum operating systems Windows 98/Me, Windows XP, Windows 2000, Windows NT 4.0 SP6

See Also