Opened 16 years ago
Last modified 16 years ago
#422 closed Bug
_GDIPlus_GraphicsSetSmoothingMode Failure — at Initial Version
Reported by: | WeaponX | Owned by: | |
---|---|---|---|
Milestone: | 3.2.13.4 | Component: | AutoIt |
Version: | 3.2.12.1 | Severity: | None |
Keywords: | Cc: |
Description
Calling _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2) returns FALSE and sets @ERROR.
The function actually changes $iSmooth into the SmoothingMode enum value:
http://msdn.microsoft.com/en-us/library/ms534173(VS.85).aspx
In the following test you can see the only values that perform smoothing are 2 and 4:
{{{#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
Const $GuiHeight = 200, $GuiWidth = 500
Global $CenterX = $GuiWidth / 2, $CenterY = $GuiHeight / 2
$hGUI = GUICreate("Anti-Aliasing", $GuiWidth, $GuiHeight)
GUISetState()
;Initialize GDI+
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
;Create pen
$hPen = _GDIPlus_PenCreate(0xFF000000, 2,2)
_GDIPlus_PenSetAlignment($hPen,0)
_GDIPlus_PenSetWidth($hPen, 1)
$LastX = 0
#cs
typedef enum {
SmoothingModeInvalid = QualityModeInvalid,
SmoothingModeDefault = QualityModeDefault,
SmoothingModeHighSpeed = QualityModeLow,
SmoothingModeHighQuality = QualityModeHigh,
SmoothingModeNone,
SmoothingModeAntiAlias8x4,
SmoothingModeAntiAlias = SmoothingModeAntiAlias8x4,
SmoothingModeAntiAlias8x8
} SmoothingMode;
#ce
For $Z = 0 to 7
$result = _GDIPlus_GraphicsSetSmoothingMode2($hGraphic, $Z)
ConsoleWrite("@ERROR: " & @ERROR & " @EXTENDED: " & @EXTENDED & " RESULT: " & $result & @CRLF)
For $X = 1 to 10
_GDIPlus_GraphicsDrawLine($hGraphic, $LastX, 0, $LastX+20, $GuiHeight, $hPen)
$LastX += 3
Next
$LastX += 3
;Reset smoothing mode
_GDIPlus_GraphicsSetSmoothingMode2($hGraphic, 0)
Next
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
Func _GDIPlus_GraphicsSetSmoothingMode2($hGraphics, $iMode)
Local $aResult
$aResult = DllCall($ghGDIPDll, "int", "GdipSetSmoothingMode", "hwnd", $hGraphics, "int", $iMode)
If @error Then Return SetError(@error, @extended, False)
Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc ;==>_GDIPlus_GraphicsSetSmoothingMode}}}