找回密码
 加入
搜索
查看: 1487|回复: 4

[AU3基础] _GDIPlus_PathAddLine五星如何原轴旋转[己解决]

[复制链接]
发表于 2020-6-4 22:23:40 | 显示全部楼层 |阅读模式
本帖最后由 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


发表于 2020-6-5 15:00:20 | 显示全部楼层
...
        $hMatrix = _GDIPlus_MatrixCreate()
        _GDIPlus_MatrixTranslate($hMatrix, 200, 200)
        _GDIPlus_MatrixRotate($hMatrix, -10, 0);旋转矩阵
                _GDIPlus_MatrixTranslate($hMatrix, -200, -200)
        _GDIPlus_PathTransform($hPath_Clone, $hMatrix)
        _GDIPlus_PathWindingModeOutline($hPath_Clone) ; 轮廓
...
 楼主| 发表于 2020-6-5 15:53:01 | 显示全部楼层
afan 发表于 2020-6-5 15:00
...
        $hMatrix = _GDIPlus_MatrixCreate()
        _GDIPlus_MatrixTranslate($hMatrix, 200, 200 ...

谢谢!谢谢!
 楼主| 发表于 2020-6-7 10:11:19 | 显示全部楼层
afan 发表于 2020-6-5 15:00
...
        $hMatrix = _GDIPlus_MatrixCreate()
        _GDIPlus_MatrixTranslate($hMatrix, 200, 200 ...

谢谢A版,现己应用到代码中





本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2020-6-7 10:38:53 | 显示全部楼层
chzj589 发表于 2020-6-7 10:11
谢谢A版,现己应用到代码中

效果不错,恭喜恭喜
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-20 14:48 , Processed in 0.073888 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表