Modify ↓
Opened 17 years ago
Closed 17 years ago
#422 closed Bug (Fixed)
_GDIPlus_GraphicsSetSmoothingMode Failure
| Reported by: | WeaponX | Owned by: | Gary |
|---|---|---|---|
| Milestone: | 3.2.13.4 | Component: | AutoIt |
| Version: | 3.2.12.1 | Severity: | None |
| Keywords: | Cc: |
Description (last modified by Valik)
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
Attachments (0)
Change History (3)
comment:1 Changed 17 years ago by Valik
- Description modified (diff)
comment:2 Changed 17 years ago by WeaponX
comment:3 Changed 17 years ago by Gary
- Milestone set to 3.2.13.4
- Owner set to Gary
- Resolution set to Fixed
- Status changed from new to closed
Fixed in version: 3.2.13.4
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
Note: See
TracTickets for help on using
tickets.

Just for added clarification, the code I posted draws 8 sets of diagonal lines. The values tested were from 0-7. Attempting to use dllcall with GdipSetSmoothingMode throws an error for values greater than 4.
The function _GDIPlus_GraphicsSetSmoothingMode2 is the same as in GDI.au3 except it passes $iMode directly instead of converting it with Switch...EndSwitch.