GDI+ Buchstaben Rotation

  • Hier 3 kleine Beispiele (2x von mir und 1x von Eukalyptus):

    Rotated Letters by Eukalyptus:

    Spoiler anzeigen
    [autoit]


    #include "GDIP.au3"
    #include <GDIPlus.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    _CheckGDIpWarpBug("GDIp.au3")

    [/autoit] [autoit][/autoit] [autoit]

    Opt("GUIOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()

    [/autoit] [autoit][/autoit] [autoit]

    $iW = 600
    $iH = 600

    [/autoit] [autoit][/autoit] [autoit]

    $hGui = GUICreate("Test", $iW, $iH)
    GUISetOnEvent(-3, "_Exit")
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
    $hBmpBuffer = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphics)
    $hGfxBuffer = _GDIPlus_ImageGetGraphicsContext($hBmpBuffer)
    _GDIPlus_GraphicsSetSmoothingMode($hGfxBuffer, 2)
    _GDIPlus_GraphicsClear($hGfxBuffer, 0xFF000000)

    [/autoit] [autoit][/autoit] [autoit]

    $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFAA00)
    $hBrushTrans = _GDIPlus_BrushCreateSolid(0x66000000)

    [/autoit] [autoit][/autoit] [autoit]

    $sText = "Rotated Letters by Eukalyptus ;)"

    [/autoit] [autoit][/autoit] [autoit]

    $hPath = _CreateTextPath($sText, 400, "Impact", 110)

    [/autoit] [autoit][/autoit] [autoit]

    $hMatrix = _GDIPlus_MatrixCreate()

    [/autoit] [autoit][/autoit] [autoit]

    GUIRegisterMsg($WM_PAINT, "WM_PAINT")
    GUIRegisterMsg($WM_ERASEBKGND, "WM_ERASEBKGND")

    [/autoit] [autoit][/autoit] [autoit]

    Global $aPoints[5][2]
    $aPoints[0][0] = 4
    $aPoints[1][0] = $iW / 2 - $iW * 0.2
    $aPoints[1][1] = $iH / 2 - $iH * 0.2
    $aPoints[2][0] = $iW / 2 + $iW * 0.2
    $aPoints[2][1] = $iH / 2 - $iH * 0.2
    $aPoints[3][0] = 0
    $aPoints[3][1] = $iH
    $aPoints[4][0] = $iW
    $aPoints[4][1] = $iH

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    _RotateMatrix()

    [/autoit] [autoit][/autoit] [autoit]

    $hPathClone = _GDIPlus_PathClone($hPath)
    _GDIPlus_PathTransform($hPathClone, $hMatrix)
    _GDIPlus_PathWarp($hPathClone, 0, $aPoints, 0, 0, $iW, $iH + $iH * 0.3)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsFillRect($hGfxBuffer, 0, 0, $iW, $iH, $hBrushTrans)
    _GDIPlus_GraphicsFillPath($hGfxBuffer, $hPathClone, $hBrush)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_PathDispose($hPathClone)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0)
    ;Sleep(10)
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _RotateMatrix()
    Local Static $iStep = 0
    $iStep += 0.003
    _GDIPlus_MatrixSetElements($hMatrix, 1, 0, 0, 1, 0, 0)
    _GDIPlus_MatrixTranslate($hMatrix, $iW / 2, $iH / 2)
    _GDIPlus_MatrixRotate($hMatrix, -(Sin($iStep) * 360))
    _GDIPlus_MatrixTranslate($hMatrix, -$iW / 2, -$iH / 2)
    EndFunc ;==>_RotateMatrix

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _CreateTextPath($sText, $iR, $sFont, $fSize)
    Local $hPath = _GDIPlus_PathCreate()

    [/autoit] [autoit][/autoit] [autoit]

    Local $hFormat = _GDIPlus_StringFormatCreate()
    Local $hFamily = _GDIPlus_FontFamilyCreate("Arial")
    Local $tLayout = _GDIPlus_RectFCreate(0, 0, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    Local $aSplit = StringSplit($sText, "")
    Local $aPath[$aSplit[0] + 1][2]
    Local $aBounds, $iLen = 0

    [/autoit] [autoit][/autoit] [autoit]

    Local $hMatrix = _GDIPlus_MatrixCreate()

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 1 To $aSplit[0]
    $aPath[$i][0] = _GDIPlus_PathCreate()
    _GDIPlus_PathAddString($aPath[$i][0], $aSplit[$i], $tLayout, $hFamily, 0, $fSize, $hFormat)
    $aBounds = _GDIPlus_PathGetWorldBounds($aPath[$i][0])
    $aPath[$i][1] = $aBounds[2]
    If $aSplit[$i] = " " Then $aPath[$i][1] = $fSize / 3
    $iLen += $aPath[$i][1]
    _GDIPlus_MatrixTranslate($hMatrix, $iW / 2 - $aBounds[2], $iH / 2 - $iR)
    _GDIPlus_PathTransform($aPath[$i][0], $hMatrix)
    _GDIPlus_MatrixSetElements($hMatrix, 1, 0, 0, 1, 0, 0)
    Next

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 1 To $aSplit[0]
    _GDIPlus_MatrixTranslate($hMatrix, $iW / 2, $iH / 2)
    _GDIPlus_MatrixRotate($hMatrix, -($aPath[$i][1] * 340 / $iLen))
    _GDIPlus_MatrixTranslate($hMatrix, -$iW / 2, -$iH / 2)
    _GDIPlus_PathTransform($hPath, $hMatrix)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_PathAddPath($hPath, $aPath[$i][0], False)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_MatrixSetElements($hMatrix, 1, 0, 0, 1, 0, 0)
    Next

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_MatrixDispose($hMatrix)
    For $i = 1 To $aSplit[0]
    _GDIPlus_PathDispose($aPath[$i][0])
    Next
    Return $hPath
    EndFunc ;==>_CreateTextPath

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func WM_PAINT($hWnd, $uMsgm, $wParam, $lParam)
    _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0)
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_PAINT

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_ERASEBKGND($hWnd, $uMsgm, $wParam, $lParam)
    _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0)
    Return True
    EndFunc ;==>WM_ERASEBKGND

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_BrushDispose($hBrushTrans)
    _GDIPlus_GraphicsDispose($hGfxBuffer)
    _GDIPlus_BitmapDispose($hBmpBuffer)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>_Exit

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _CheckGDIpWarpBug($sPath)
    If Not FileExists($sPath) Then
    MsgBox(0, "error", $sPath & " not found")
    Return
    EndIf
    Local $sSource = FileRead($sPath)
    Local $aRegExp = StringRegExp($sSource, "(?is)Func\h+_GDIPlus_PathWarp(.*?)EndFunc", 3)
    If Not IsArray($aRegExp) Then
    MsgBox(0, "error", "Func _GDIPlus_PathWarp not found in" & @CRLF & $sPath)
    Return
    EndIf
    If StringRegExp($aRegExp[0], "(?i)\$iCount\h+<>\h+3\h+Or") Then
    $sSource = StringLeft($sSource, StringInStr($sSource, "Func _GDIPlus_PathWarp"))
    $aRegExp[0] = StringLeft($aRegExp[0], StringInStr($aRegExp[0], "If $iCount <> 3"))
    Local $iLine = 1
    StringRegExpReplace($sSource, "\r", "")
    $iLine += @extended
    StringRegExpReplace($aRegExp[0], "\r", "")
    $iLine += @extended
    MsgBox(0, "error found", "error in " & $sPath & @CRLF & "change line " & $iLine & @CRLF & "If $iCount <> 3 Or $iCount <> 4 Then" & @CRLF & "to:" & @CRLF & "If $iCount <> 3 And $iCount <> 4 Then")
    EndIf
    EndFunc ;==>_CheckGDIpWarpBug

    [/autoit]

    Rotated Letters:

    Spoiler anzeigen
    [autoit]


    ;coded by UEZ 2011 build 2011-04-06
    ;~ #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
    #AutoIt3Wrapper_Run_Obfuscator=y
    #Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
    #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_Obfuscated.au3"
    #AutoIt3Wrapper_UseUpx=y
    #AutoIt3Wrapper_UPX_Parameters=--brute --crp-ms=999999 --all-methods --all-filters

    [/autoit] [autoit][/autoit] [autoit]

    #include <Array.au3>
    #include <GDIPlus.au3>
    Opt("GUIOnEventMode", 1)
    Opt("MustDeclareVars", 1)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $iW = 600
    Global Const $iH = 600
    Global Const $iW2 = $iW / 2
    Global Const $iH2 = $iH / 2

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $hgui = GUICreate("GDI+ Rotated Letters by UEZ 2011 Beta", $iW, $iH)
    GUISetBkColor(0x202040, $hgui)
    WinSetTrans($hgui, "", 0xFF)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hgui)
    Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphic)
    Global $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2)
    Global $ps = 4
    Global $hPen = _GDIPlus_PenCreate(0xFFFFA000, $ps)
    Global $radius = 250
    Global $sText = " Rotated Letters by UEZ 2011 Beta #"
    Global $hBMP = CreateRotatedLetters($sText, $iW, $iH)

    [/autoit] [autoit][/autoit] [autoit]

    Global $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_GraphicsDrawImageRect($hBackbuffer, $hBMP, 0, 0, $iW, $iH)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetOnEvent(-3, "_Exit")
    Global $i = 0
    While Sleep(10)
    $i -= 0.01
    _GDIPlus_GraphicsClear($hBackbuffer, 0x80202020)
    _GDIPlus_GraphicsDrawImageRect($hBackbuffer, $hBMP, 0, 0, $iW, $iH)
    _GDIPlus_GraphicsDrawEllipse($hBackbuffer, $ps - 2, $ps - 2, $iW - $ps - 2, $iH - $ps - 2, $hPen)
    _GDIPlus_GraphicsDrawEllipse($hBackbuffer, 95, 95, $iW - 2 * 95, $iH - 2 * 95, $hPen)
    _GDIPlus_MatrixTranslate($hMatrix, $iW2, $iH2)
    _GDIPlus_MatrixRotate($hMatrix, Sin($i), False)
    _GDIPlus_MatrixTranslate($hMatrix, -$iW2, -$iH2)
    _GDIPlus_GraphicsSetTransform($hBackbuffer, $hMatrix)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iW, $iH)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func CreateRotatedLetters($sText, $iW, $iH, $fontsize = 60, $radius = 250, $letter_w = 100, $letter_h = 100, $font = "Impact", $rv = 20, $gv = 100, $bv = 240, $start_angle = 0)
    Local Const $iW2 = $iW / 2
    Local Const $iH2 = $iH / 2
    Local Const $sLen = StringLen($sText)
    Local $j = $sLen / 2
    Local Const $delta_a = Floor(360 / $sLen)
    Local Const $letter_w2 = $letter_w / 2
    Local Const $letter_h2 = $letter_h / 2
    Local Const $center_x = $iW2 - $letter_w2
    Local Const $center_y = $iH2 - $letter_h2
    Local Const $deg = ACos(-1) / 180

    [/autoit] [autoit][/autoit] [autoit]

    Local $aTable[$sLen][12]
    Local $i, $r, $g, $b, $a, $lW, $lH, $x, $y
    Local $hImage = _GDIPlus_BitmapCreateFromScan0($iW, $iH)
    Local $hContext = _GDIPlus_ImageGetGraphicsContext($hImage)
    For $i = 0 To $sLen - 1 ;generate table
    $aTable[$i][0] = StringMid($sText, $i + 1, 1) ;get next letter
    $aTable[$i][1] = _GDIPlus_BitmapCreateFromScan0($letter_w, $letter_h) ;create bitmap
    $aTable[$i][2] = _GDIPlus_ImageGetGraphicsContext($aTable[$i][1]) ;create context of bitmap to draw to bitmap
    $r = 0xFF - Sin($j / 10) * $rv
    $g = 0xFF - Sin($j / 10) * $gv
    $b = 0xFF - Sin($j / 10) * $bv
    $j -= 0.5
    $aTable[$i][3] = _GDIPlus_BrushCreateSolid("0xFF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2))
    $aTable[$i][4] = _GDIPlus_StringFormatCreate() ;$hFormat
    $aTable[$i][5] = _GDIPlus_FontFamilyCreate($font) ;$hFamily
    $aTable[$i][6] = _GDIPlus_FontCreate($aTable[$i][5], $fontsize) ;$hFont
    $aTable[$i][7] = _GDIPlus_RectFCreate(0, 0, 0, 0) ;$tLayout
    $aTable[$i][8] = _GDIPlus_GraphicsMeasureString($hGraphic, $aTable[$i][0], $aTable[$i][6], $aTable[$i][7], $aTable[$i][4])
    $aTable[$i][9] = _GDIPlus_MatrixCreate() ;create a matrix for each letter
    $aTable[$i][10] = $i * $delta_a + $start_angle ;calculate angle of letter
    $aTable[$i][11] = $radius ;radius
    _GDIPlus_GraphicsSetSmoothingMode($aTable[$i][2], 2)
    DllCall($ghGDIPDll, "uint", "GdipSetTextRenderingHint", "handle", $aTable[$i][2], "int", 3)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsClear($aTable[$i][2], 0x00000000)
    ;calculated possition of letter to place it in the middle of the graphic
    $a = $aTable[$i][8]
    $lW = DllStructGetData($a[0], "width")
    $lH = DllStructGetData($a[0], "height")
    DllStructSetData($a[0], "x", $letter_w2 - $lW / 2)
    DllStructSetData($a[0], "y", $letter_h2 - $lH / 2)

    [/autoit] [autoit][/autoit] [autoit]

    ;rotate letter
    _GDIPlus_MatrixTranslate($aTable[$i][9], $letter_w2, $letter_h2)
    _GDIPlus_MatrixRotate($aTable[$i][9], -27 + $aTable[$i][10], False)
    _GDIPlus_MatrixTranslate($aTable[$i][9], -$letter_w2, -$letter_h2)
    _GDIPlus_GraphicsSetTransform($aTable[$i][2], $aTable[$i][9])

    [/autoit] [autoit][/autoit] [autoit]

    ;print letter to bitmap
    _GDIPlus_GraphicsDrawStringEx($aTable[$i][2], $aTable[$i][0], $aTable[$i][6], $a[0], $aTable[$i][4], $aTable[$i][3])

    [/autoit] [autoit][/autoit] [autoit]

    ;copy letter to main screen in a circle
    $x = $center_x + Cos(-90 + $aTable[$i][10] * $deg) * $aTable[$i][11]
    $y = $center_y + Sin(-90 + $aTable[$i][10] * $deg) * $aTable[$i][11]
    _GDIPlus_GraphicsDrawImage($hContext, $aTable[$i][1], $x, $y)
    Next

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To $sLen - 1
    _GDIPlus_BitmapDispose($aTable[$i][1])
    _GDIPlus_GraphicsDispose($aTable[$i][2])
    _GDIPlus_BrushDispose($aTable[$i][3])
    _GDIPlus_StringFormatDispose($aTable[$i][4])
    _GDIPlus_FontFamilyDispose($aTable[$i][5])
    _GDIPlus_FontDispose($aTable[$i][6])
    _GDIPlus_MatrixDispose($aTable[$i][9])
    Next
    _GDIPlus_GraphicsDispose($hContext)
    Return $hImage
    EndFunc ;==>CreateRotatedLetters

    [/autoit] [autoit][/autoit] [autoit]

    Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iStride = 0, $iPixelFormat = 0x0026200A, $pScan0 = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[6]
    EndFunc ;==>_GDIPlus_BitmapCreateFromScan0

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_GraphicsDispose($hBackbuffer)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_BitmapDispose($hBMP)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
    GUIDelete($hgui)
    Exit
    EndFunc ;==>_Exit

    [/autoit]

    Ballet of Letters:

    Spoiler anzeigen
    [autoit]


    ;coded by UEZ 2011 build 2011-04-08
    #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
    #AutoIt3Wrapper_Run_Obfuscator=y
    #Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
    #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_Obfuscated.au3"
    #AutoIt3Wrapper_UseUpx=y
    #AutoIt3Wrapper_UPX_Parameters=--brute --crp-ms=999999 --all-methods --all-filters
    #include <Array.au3>
    #include <GDIPlus.au3>
    Opt("GUIOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $iW = 600
    Global Const $iW2 = $iW / 2
    Global Const $iH = 600
    Global Const $iH2 = $iH / 2

    [/autoit] [autoit][/autoit] [autoit]

    Global $hgui = GUICreate("GDI+ Ballet of Letters by UEZ 2011 Build 2011-04-08", $iW, $iH)
    GUISetBkColor(0x000000, $hgui)

    [/autoit] [autoit][/autoit] [autoit]

    Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hgui)
    Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphic)
    Global $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    Global $hPen = _GDIPlus_PenCreate(0)

    [/autoit] [autoit][/autoit] [autoit]

    ;~ _GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2)

    [/autoit] [autoit][/autoit] [autoit]

    Global $sText = " Ballet of Letters by UEZ 2011 #"
    Const $sLen = StringLen($sText)
    Const $delta_a = Floor(360 / $sLen)
    Const $letter_w = 100
    Const $letter_w2 = $letter_w / 2
    Const $letter_h = 100
    Const $letter_h2 = $letter_h / 2
    Const $center_x = $iW2 - $letter_w2
    Const $center_y = $iH2 - $letter_h2

    [/autoit] [autoit][/autoit] [autoit]

    Const $font = "Impact"
    Const $fontsize = $sLen * 1.75
    Const $radius = 220
    Const $deg = ACos(-1) / 180

    [/autoit] [autoit][/autoit] [autoit]

    Global $aTable[$sLen][12]
    Global $j = $sLen / 2, $r, $g, $b, $a, $lW, $lH, $x, $y

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To $sLen - 1 ;generate table
    $aTable[$i][0] = StringMid($sText, $i + 1, 1) ;get next letter
    $aTable[$i][1] = _GDIPlus_BitmapCreateFromGraphics($letter_w, $letter_h, $hGraphic) ;create bitmap
    $aTable[$i][2] = _GDIPlus_ImageGetGraphicsContext($aTable[$i][1]) ;create context of bitmap to draw to bitmap
    $r = 0xFF - Sin($j / 10) * 20
    $g = 0xFF - Sin($j / 10) * 100
    $b = 0xFF - Sin($j / 10) * 220
    $j -= 0.5
    $aTable[$i][3] = _GDIPlus_BrushCreateSolid("0xE0" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2))
    $aTable[$i][4] = _GDIPlus_StringFormatCreate() ;$hFormat
    $aTable[$i][5] = _GDIPlus_FontFamilyCreate($font) ;$hFamily
    $aTable[$i][6] = _GDIPlus_FontCreate($aTable[$i][5], $fontsize) ;$hFont
    $aTable[$i][7] = _GDIPlus_RectFCreate(0, 0, 0, 0) ;$tLayout
    $aTable[$i][8] = _GDIPlus_GraphicsMeasureString($hGraphic, $aTable[$i][0], $aTable[$i][6], $aTable[$i][7], $aTable[$i][4])
    $aTable[$i][9] = _GDIPlus_MatrixCreate() ;create a matrix for each letter
    $aTable[$i][10] = $i * $delta_a ;calculate angle of letter
    $aTable[$i][11] = $radius ;radius
    _GDIPlus_GraphicsSetSmoothingMode($aTable[$i][2], 2)
    DllCall($ghGDIPDll, "uint", "GdipSetTextRenderingHint", "handle", $aTable[$i][2], "int", 4)
    ;~ DllCall($ghGDIPDll, "uint", "GdipSetTextRenderingHint", "handle", $hBackbuffer, "int", 4)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsClear($aTable[$i][2], 0x00000000)
    ;calculated possition of letter to place it in the middle of the graphic
    $a = $aTable[$i][8]
    $lW = DllStructGetData($a[0], "width")
    $lH = DllStructGetData($a[0], "height")
    DllStructSetData($a[0], "x", $letter_w2 - $lW / 2)
    DllStructSetData($a[0], "y", $letter_h2 - $lH / 2)

    [/autoit] [autoit][/autoit] [autoit]

    ;rotate letter
    _GDIPlus_MatrixTranslate($aTable[$i][9], $letter_w2, $letter_h2)
    _GDIPlus_MatrixRotate($aTable[$i][9], -27 + $aTable[$i][10], False)
    _GDIPlus_MatrixTranslate($aTable[$i][9], -$letter_w2, -$letter_h2)
    _GDIPlus_GraphicsSetTransform($aTable[$i][2], $aTable[$i][9])

    [/autoit] [autoit][/autoit] [autoit]

    ;print letter to graphic
    _GDIPlus_GraphicsDrawStringEx($aTable[$i][2], $aTable[$i][0], $aTable[$i][6], $a[0], $aTable[$i][4], $aTable[$i][3])

    [/autoit] [autoit][/autoit] [autoit]

    ;copy letter to main screen in a circle
    $x = $center_x + Cos(-90 + $aTable[$i][10] * $deg) * $aTable[$i][11]
    $y = $center_y + Sin(-90 + $aTable[$i][10] * $deg) * $aTable[$i][11]
    _GDIPlus_GraphicsDrawImage($hBackbuffer, $aTable[$i][1], $x, $y)
    Next

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $warpZ = 16
    Global Const $units = 200
    Global $cycle = 0 ;for color
    Global Const $Z = 0.1
    Global $stars[$units][5] ;x,y,z,px,py
    Global $cx = $iW2, $cy = $iH2

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To $units - 1
    Reset_Star($i)
    Next

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    GUISetOnEvent(-3, "_Exit")

    [/autoit] [autoit][/autoit] [autoit]

    While Sleep(10)
    _GDIPlus_GraphicsClear($hBackbuffer, 0x70000000)
    Draw_Stars()
    Rotation()
    _GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 0)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func Rotation()
    Local Static $aa = 0
    Local Static $bb = 0
    Local Static $c = 1

    [/autoit] [autoit][/autoit] [autoit]

    $aa += 0.01
    $bb += 1.5 * $c
    If $bb < -50 Or $bb > 50 Then $c *= -1

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To $sLen - 1
    _GDIPlus_GraphicsClear($aTable[$i][2], 0x00000000)

    [/autoit] [autoit][/autoit] [autoit]

    $aTable[$i][10] -= 1.5 * Cos($aa)
    $aTable[$i][11] += -$bb / 8 + Cos($bb ^2* $aa)

    [/autoit] [autoit][/autoit] [autoit]

    $a = $aTable[$i][8]
    _GDIPlus_MatrixTranslate($aTable[$i][9], $letter_w2, $letter_h2)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_MatrixRotate($aTable[$i][9], -1 + Sin($aa) * 15, False)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_MatrixTranslate($aTable[$i][9], -$letter_w2, -$letter_h2)
    _GDIPlus_GraphicsSetTransform($aTable[$i][2], $aTable[$i][9])
    _GDIPlus_GraphicsDrawStringEx($aTable[$i][2], $aTable[$i][0], $aTable[$i][6], $a[0], $aTable[$i][4], $aTable[$i][3])

    [/autoit] [autoit][/autoit] [autoit]

    $x = $center_x + Cos(-90 * (1 + Sin(-$aa / 100)) + $aTable[$i][10] * $deg) * $aTable[$i][11]
    $y = $center_y + Sin(-90 * (1 + Cos($aa / 20)) + $aTable[$i][10] * $deg) * $aTable[$i][11]
    _GDIPlus_GraphicsDrawImage($hBackbuffer, $aTable[$i][1], $x, $y)
    Next
    EndFunc ;==>Rotation1

    [/autoit] [autoit][/autoit] [autoit]

    Func Draw_Stars()
    Local $i, $r, $g, $b, $xx, $yy, $e, $color
    Local Static $ii = -99
    $ii += 0.0075
    $cx = $iW2 + (110 * Cos($ii * 3))
    $cy = $iH2 + (100 * Sin($ii * 4))

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To $units - 1
    $xx = $stars[$i][0] / $stars[$i][2]
    $yy = $stars[$i][1] / $stars[$i][2]
    $e = 1 + 1 / $stars[$i][2] * 2
    If $stars[$i][3] <> 0 Then
    $r = 0x40 + Sin($i + $cycle) * 50
    $g = 0x40 + Sin($i + $cycle) * 50
    $b = 0x40 + Sin($i + $cycle) * 50
    $color = "0xF0"& Hex($r, 2) & Hex($g, 2) & Hex($b, 2)
    _GDIPlus_PenSetWidth($hPen, $e)
    _GDIPlus_PenSetColor($hPen, $color)
    _GDIPlus_GraphicsDrawRect($hBackbuffer, $xx + $cx, $yy + $cy, $e, $e, $hPen)
    EndIf
    $stars[$i][2] -= $Z
    $stars[$i][3] = $xx
    $stars[$i][4] = $yy
    If $stars[$i][2] < $Z Or $stars[$i][3] > $iW Or $stars[$i][4] > $iH Then Reset_Star($i)
    Next
    $cycle += 0.1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func Reset_Star($a)
    $stars[$a][0] = (Random(0, 1) * $iW - ($iW / 2)) * $warpZ
    $stars[$a][1] = (Random(0, 1) * $iH - ($iH / 2)) * $warpZ
    $stars[$a][2] = $warpZ
    $stars[$a][3] = 0
    $stars[$a][4] = 0
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    _GDIPlus_PenDispose($hPen)
    For $i = 0 To $sLen - 1
    _GDIPlus_BitmapDispose($aTable[$i][1])
    _GDIPlus_GraphicsDispose($aTable[$i][2])
    _GDIPlus_BrushDispose($aTable[$i][3])
    _GDIPlus_StringFormatDispose($aTable[$i][4])
    _GDIPlus_FontFamilyDispose($aTable[$i][5])
    _GDIPlus_FontDispose($aTable[$i][6])
    _GDIPlus_MatrixDispose($aTable[$i][9])
    Next
    _GDIPlus_GraphicsDispose($hBackbuffer)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
    GUIDelete($hgui)
    Exit
    EndFunc ;==>_Exit

    [/autoit]

    Vielleicht gefällt es ja euch!

    Gruß,
    UEZ

    Edit: GDIp.au3 gibts hier: http://www.autoitscript.com/forum/topic/106021-gdip-au3

  • Nabend bekomme bei einem Script

    Zitat

    C:\Users\Dietmar\AppData\Local\Temp\Rotated Letters by Eukalyptus.au3(1,10) : ERROR: can't open include file <GDIP.au3>
    #include <GDIP.au3>

    Aber was man bis da sehen konnte ist schon sehr beeindruckend. :D
    Besonders das Ballet

    Achtung Anfänger! :whistling:

    Betrachten des Quellcodes auf eigene Gefahr, bei Übelkeit,Erbrechen,Kopfschmerzen übernehme ich keine Haftung. 8o

  • Nabend bekomme bei einem Script

    Aber was man bis da sehen konnte ist schon sehr beeindruckend. :D
    Besonders das Ballet

    Eukalyptus' Funktion dient dazu den Bug in der Warp Funktion zu korrigieren!

    Folgende Funktion ist die korrekte Funktion!

    [autoit]


    Func _GDIPlus_PathWarp($hPath, $hMatrix, $aPoints, $nX, $nY, $nWidth, $nHeight, $iWarpMode = 0, $nFlatness = $FlatnessDefault)
    Local $iI, $iCount, $pPoints, $tPoints, $aResult

    [/autoit][autoit][/autoit][autoit]

    $iCount = $aPoints[0][0]
    If $iCount <> 3 And $iCount <> 4 Then
    $GDIP_ERROR = 1
    Return False
    EndIf

    [/autoit][autoit][/autoit][autoit]

    $tPoints = DllStructCreate("float[" & $iCount * 2 & "]")
    $pPoints = DllStructGetPtr($tPoints)

    [/autoit][autoit][/autoit][autoit]

    For $iI = 1 To $iCount
    DllStructSetData($tPoints, 1, $aPoints[$iI][0], ($iI - 1) * 2 + 1)
    DllStructSetData($tPoints, 1, $aPoints[$iI][1], ($iI - 1) * 2 + 2)
    Next

    [/autoit][autoit][/autoit][autoit]

    $aResult = DllCall($ghGDIPDll, "uint", "GdipWarpPath", "hwnd", $hPath, "hwnd", $hMatrix, "ptr", $pPoints, "int", $iCount, "float", $nX, "float", $nY, "float", $nWidth, "float", $nHeight, "int", $iWarpMode, "float", $nFlatness)
    If @error Then Return SetError(@error, @extended, False)

    [/autoit][autoit][/autoit][autoit]

    $GDIP_STATUS = $aResult[0]
    Return $aResult[0] = 0
    EndFunc ;==>_GDIPlus_PathWarp

    [/autoit]

    Am besten diese Funktion in der GDIp.au3 suchen und ersetzen, da ansonsten der Effekt nicht funzt!

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

  • Genial! Ich finde es wirklich gut geworden, ich muss mir das mal in Ruhe durchlesen. Eine Frage vorweg, was ist GDIP? Ist das eine Art erweiterte Form von GDI+? Ich habs schon öfters gesehen, z.B. auch in den 3D Würfel Scripten.

    mfg BB

    "IF YOU'RE GOING TO KILL IT
    OPEN SOURCE IT!"

    by Phillip Torrone

    Zitat von Shoutbox

    [Heute, 11:16] Andy: ....böseböseböseböse....da erinnere ich mich daran, dass man den Puschelschwanz eines KaRnickels auch "Blume" nennt....ob da eins zum anderen passt? :rofl: :rofl: :rofl: :rofl:

    https://autoit.de/index.php?page…leIt#post251138

    Neon Snake

  • GDIp.au3 ist im Prinzip die Erweiterung (inoffiziell) der GDIPlus (GDIPlus.au3) Bibliothek!

    Teilweise hat sie leider noch ein paar Bugs...

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

  • Zitat

    Vielleicht gefällt es ja euch!


    Auf jeden Fall!!
    Ich bin immer wieder von deinen Künsten beeindruckt!
    Computergrafik finde ich sehr interessant, drum würde es mich interessieren
    woher du die Formeln hast.. oder leitest du dir das durch etwas überlegen selbst her?
    Einige kleine Formeln (Drehmatrix z.B.) hab ich auch schon verwendet, aber das ist
    sicherlich erst einer der ersten Schritte ;)

    Anbei ist noch ein Screenshot, der einen "Schmiereffekt" zeigt.
    Liegt es an meinem vllt. nicht übermäßig schnellen Rechner?
    Zumindest erscheint es mir, als hätte er ziemlich viel zutun...
    snapshot

    Mögen noch VIELE! weitere Scripte folgen...
    MfG. ein großer Fan :D

    Wer immer nur das tut, was er bereits kann - wird auch immer nur das bleiben, was er bereits ist!

  • Der "Schmiereffekt" ist gewollt, kannst es in Zeile 107 entsprechend anpassen, z.B. _GDIPlus_GraphicsClear($hBackbuffer, 0xE0000000), dann schmiert's nicht so sehr.

    Nun ja, das gesamte Konstrukt benötigt ziemlich viel CPU Power :whistling:

    Woher bekomme ich die Formeln: probieren geht über Studieren ;)

    Natürlich sollte man ein bissl Gefühl für Sinus und Kosinus haben und ich bin sicherlich kein Mathe Genie!

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

  • Also, ich hab mir das mal in Ruhe durchgelesen und ich möchte dich fragen ob es richtig ist, so wie ich es verstanden hab. Als erstes erstellest du wie immer eine Graphics, eine Bitmap und den Backbuffer. Dann erstellest du in der Func "CreateRotatedLetters()" ein Image mit den Buchstaben im Kreis, das ist die aus meiner Sicht interessanteste Funktion in dem Script. Nachdem du das Bild fertig hast zeichnest du es auf die Graphic (Backbuffer>Graphic) und lässt es rotieren. Durch

    [autoit]

    _GDIPlus_MatrixRotate($hMatrix, Sin($i), False)

    [/autoit]

    dreht sich der Textkreis irg wann in die andere Richtung, weil Sinus es dann umkehrt (sogenau kenn ich mich noch nicht mir Sinus und Kosinus aus...) auf jeden Fall beschleunigt es nur wenn man Sin() rausnimmt :D.

    Was mich auchnoch interessiert sind die Matrix funktionen, ich hab es bis jetzt noch nicht geschafft die Achse in den Mittelpunkt zu setzen. Ich denke der Trick liegt in

    [autoit]

    _GDIPlus_MatrixTranslate($hMatrix, -$iW2, -$iH2)

    [/autoit]

    Ich würde mich freuen wenn du mir sagen könntest ob ich etwas wichtiges vergessen hab oder ob ich etwas falsch verstanden hab.

    mfg BB

    "IF YOU'RE GOING TO KILL IT
    OPEN SOURCE IT!"

    by Phillip Torrone

    Zitat von Shoutbox

    [Heute, 11:16] Andy: ....böseböseböseböse....da erinnere ich mich daran, dass man den Puschelschwanz eines KaRnickels auch "Blume" nennt....ob da eins zum anderen passt? :rofl: :rofl: :rofl: :rofl:

    https://autoit.de/index.php?page…leIt#post251138

    Neon Snake

  • Was mich auchnoch interessiert sind die Matrix funktionen, ich hab es bis jetzt noch nicht geschafft die Achse in den Mittelpunkt zu setzen. Ich denke der Trick liegt in

    [autoit]

    _GDIPlus_MatrixTranslate($hMatrix, -$iW2, -$iH2)

    [/autoit]

    Richtig! :)

    _GDIPlus_MatrixTranslate setzt quasi den Offset auf einer "Graphics"
    Der Rotationspunkt liegt auf den Koordinaten 0/0, deshalb muss man vorher den Offset in die Mitte verschieben

    [autoit]

    _GDIPlus_MatrixTranslate($hMatrix, $iW / 2, $iH / 2)

    [/autoit]

    dann Rotieren

    [autoit]

    _GDIPlus_MatrixRotate($hMatrix, 0.3, False)

    [/autoit]

    und dann wieder den Offset zurücksetzen

    [autoit]

    _GDIPlus_MatrixTranslate($hMatrix, -$iW / 2, -$iH / 2)

    [/autoit]

    , denn erstens wird sonst auch das Bild mit diesem Offset gezeichnent und zweitens addieren sich die Werte und beim zweiten Schleifendurchlauf hat man dann schon den doppelten Offset.

    E

  • Hey schönes skript, alle 3

    Ich hab aber mal ne Frage, und zwar hab ich im letzten Skript oben folgende Zeilen gefunden:

    Code
    #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
    #AutoIt3Wrapper_Run_Obfuscator=y
    #Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
    #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_Obfuscated.au3"
    #AutoIt3Wrapper_UseUpx=y
    #AutoIt3Wrapper_UPX_Parameters=--brute --crp-ms=999999 --all-methods --all-filters

    wenn ich die lösche, dann funktionierts genauso, was bringen die also?

    kann man das irgendwo nachlesen?

    Danke

    DFPWare

  • Du kannst unter <AutoIt Dir>\SciTE\AutoIt3Wrapper\Directives.au3 die Befehle für den Wrapper einsehen.

    #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6: dient dazu, das Skript vor dem Kompilieren auf "Inkonsistenzen" zu prüfen, z.B. nicht verwendete Variablen, Funktionen, etc. werden ausgegeben, also nur Hinweise.

    #AutoIt3Wrapper_Run_Obfuscator=y
    #Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
    : hier wird der Obfuscator angeschmissen und der Source Code gestrafft, z.B. werden Variablen Namen gekürzt. Dabei wird eine neue Datei mit dem Namen <Skriptname>_Obfuscated.au3 erstellt, dass anschließend kompiliert wird. Dient eigentlich nur dazu, das Skript dadurch "schneller" zu machen. Kannst ja mal in diese Datei reinschauen. Ansonsten stehen hier mehr Infos: http://www.autoitscript.com/forum/topic/10…post__p__721154

    #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_Obfuscated.au3": löscht die temp. Datei <Skriptname>_Obfuscated.au3 anschließend

    #AutoIt3Wrapper_UseUpx=y
    #AutoIt3Wrapper_UPX_Parameters=--brute --crp-ms=999999 --all-methods --all-filt
    er: startet UPX mit den höchsten Packraten - Nachteil: ziemlich langsam, aber dafür ist die Exe kleiner als mit den Standard Werten.

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

    Einmal editiert, zuletzt von UEZ (27. April 2011 um 13:49)