本帖最后由 chzj589 于 2020-6-5 15:53 编辑
如题:_GDIPlus_PathAddLine五星如何原轴旋转
用: _GDIPlus_MatrixRotate($hMatrix, -10, 0);旋转矩阵,不能原轴旋转。
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
Example()
Func Example()
Local $hGUI, $hGraphic, $hBrush, $hPen, $hPath, $hPath_Clone, $hMatrix
; 创建 GUI
$hGUI = GUICreate("GDI+ UDF 示例", 800, 400)
GUISetState(@SW_SHOW)
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;在句柄指定的窗口创建图形对象
_GDIPlus_GraphicsSetSmoothingMode($hGraphic, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;设置图形对象渲染质量(抗锯齿)
_GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF)
$hBrush = _GDIPlus_BrushCreateSolid(0x7F8800AA)
$hPen = _GDIPlus_PenCreate(0xFF8800AA, 2)
$hPath = _GDIPlus_PathCreate() ;创建新路径对象
_GDIPlus_PathAddLine($hPath, 106, 330, 200, 40)
_GDIPlus_PathAddLine($hPath, 294, 330, 48, 151)
_GDIPlus_PathAddLine($hPath, 352, 151, 106, 330)
$hPath_Clone = _GDIPlus_PathClone($hPath) ;创建路径副本
$hMatrix = _GDIPlus_MatrixCreate()
_GDIPlus_MatrixTranslate($hMatrix, 100, 50)
_GDIPlus_MatrixRotate($hMatrix, -10, 0);旋转矩阵
_GDIPlus_PathTransform($hPath_Clone, $hMatrix)
_GDIPlus_PathWindingModeOutline($hPath_Clone) ; 轮廓
_GDIPlus_GraphicsFillPath($hGraphic, $hPath_Clone, $hBrush) ;填充路径到图形句柄指定的 GUI
_GDIPlus_GraphicsDrawPath($hGraphic, $hPath_Clone, $hPen) ;绘制路径到图形句柄指定的 GUI
; 循环到用户退出.
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; 清理资源
_GDIPlus_MatrixDispose($hMatrix)
_GDIPlus_PathDispose($hPath)
_GDIPlus_PathDispose($hPath_Clone)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
EndFunc ;==>Example
|