GDI+ AutoIt Logo

  • Hi

    Eigentlich wollte ich einen ganz anderen Effekt ausprobieren, hat jedoch leider nicht geklappt...
    Dennoch ist das entstandene Script ganz hübsch anzusehen, denke ich :D
    autoit.de/wcf/attachment/20997/

    Viel Spaß beim ausprobieren!

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <GDIPlusConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WinAPI.au3>
    #include <WindowsConstants.au3>

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

    Opt("GUIOnEventMode", 1)
    Opt("MustDeclareVars", 1)

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

    _GDIPlus_Startup()

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

    Global $aAutoIt = _CreateAutoItLogo()
    Global $aAutoIt_Dim = _CalcLogoDim($aAutoIt)

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

    Global $iWidth = $aAutoIt_Dim[8] * 2 + 20
    Global $iHeight = $aAutoIt_Dim[9] * 2 + 20

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

    Global $hGui = GUICreate("AutoIt GDI+", $iWidth, $iHeight)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    Global $hDC = _WinAPI_GetDC($hGui)
    Global $hBMP = _WinAPI_CreateCompatibleBitmap($hDC, $iWidth, $iHeight)
    Global $hBmpTmp = _GDIPlus_BitmapCreateFromHBITMAP($hBMP)
    _WinAPI_DeleteObject($hBMP)
    $hBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmpTmp)
    _GDIPlus_BitmapDispose($hBmpTmp)
    Global $hCDC = _WinAPI_CreateCompatibleDC($hDC)
    Global $hOBJ = _WinAPI_SelectObject($hCDC, $hBMP)
    Global $hGfxBuffer = _GDIPlus_GraphicsCreateFromHDC($hCDC)
    _GDIPlus_GraphicsSetSmoothingMode($hGfxBuffer, 2)
    _GDIPlus_GraphicsClear($hGfxBuffer, 0xFF000000)

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

    GUIRegisterMsg($WM_PAINT, "_WM_PAINT")
    GUISetState()

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

    Global $hBmp_Glow
    Global $hBmp_Alu = _CreateAlu($aAutoIt_Dim[2] + 11, $aAutoIt_Dim[3] + 11)
    Global $hBmp_AutoIt = _CreateAutoItBitmap($aAutoIt, $aAutoIt_Dim, $hBmp_Alu)
    Global $aInfo = _CreateInfoBitmap()

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

    Global $hBrush_Light = _CreateLight_Brush($aAutoIt_Dim[2] / 2, 0xBBFFFFFF, 1.2)

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

    While Sleep(10)
    _Draw()
    WEnd

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

    Func _Draw()
    Local Static $fRotate = -30, $fRotateI = 0.33, $fGlow = 0, $fLight = 0
    $fRotate += $fRotateI
    $fGlow += 0.1
    $fLight += 0.011

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

    Local $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixTranslate($hMatrix, -($aAutoIt_Dim[4] + $aAutoIt_Dim[6] / 2), -($aAutoIt_Dim[5] + $aAutoIt_Dim[7] / 2), True)
    _GDIPlus_MatrixRotate($hMatrix, $fRotate, True)
    _GDIPlus_MatrixTranslate($hMatrix, ($aAutoIt_Dim[8]), ($aAutoIt_Dim[9]), True)

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

    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $aAutoIt_Dim[8] * 2, "int", $aAutoIt_Dim[9] * 2, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
    If @error Then Return SetError(1, 3, False)
    Local $hBMP = $aResult[6]
    Local $hGfx = _GDIPlus_ImageGetGraphicsContext($hBMP)
    _GDIPlus_GraphicsSetSmoothingMode($hGfx, 2)
    _GDIPlus_GraphicsSetTransform($hGfx, $hMatrix)

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

    _GDIPlus_GraphicsDrawImage($hGfx, $hBmp_AutoIt, 0, 0)
    _GDIPlus_GraphicsDispose($hGfx)

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

    _GDIPlus_GraphicsClear($hGfxBuffer, 0xFF000000)
    _GDIPlus_GraphicsDrawImage($hGfxBuffer, $hBMP, 0, 0)
    _GDIPlus_BitmapDispose($hBMP)

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

    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
    If @error Then Return SetError(1, 3, False)
    Local $hBMP = $aResult[6]
    Local $hGfx = _GDIPlus_ImageGetGraphicsContext($hBMP)
    _GDIPlus_GraphicsSetSmoothingMode($hGfx, 2)

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

    Global $fScale = 1.007

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

    DllCall($ghGDIPDll, "uint", "GdipSetInterpolationMode", "hwnd", $hGfx, "int", 0)
    DllCall($ghGDIPDll, "uint", "GdipTranslateWorldTransform", "hwnd", $hGfx, "float", -$aAutoIt_Dim[8], "float", -$aAutoIt_Dim[9], "int", 1)
    DllCall($ghGDIPDll, "uint", "GdipRotateWorldTransform", "hwnd", $hGfx, "float", $fRotateI + Sin($fGlow) * 0.14, "int", 1)
    DllCall($ghGDIPDll, "uint", "GdipScaleWorldTransform", "hwnd", $hGfx, "float", $fScale, "float", $fScale, "int", 1)
    DllCall($ghGDIPDll, "uint", "GdipTranslateWorldTransform", "hwnd", $hGfx, "float", $aAutoIt_Dim[8], "float", $aAutoIt_Dim[9], "int", 1)

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

    Local $tColorMatrix = DllStructCreate("float[5]; float[5]; float[5]; float[5]; float[5];")
    DllStructSetData($tColorMatrix, 1, 1, 1)
    DllStructSetData($tColorMatrix, 2, 1, 2)
    DllStructSetData($tColorMatrix, 3, 1, 3)
    DllStructSetData($tColorMatrix, 4, 0.96, 4)
    DllStructSetData($tColorMatrix, 5, 1, 5)

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

    Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreateImageAttributes", "ptr*", 0)
    If @error Then Return SetError(1, 4, False)
    Local $hImgAttrib = $aResult[1]
    DllCall($ghGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", 1, "int", 1, "ptr", DllStructGetPtr($tColorMatrix), "ptr", 0, "int", 0)

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

    DllCall($ghGDIPDll, "int", "GdipDrawImageRectRectI", "hwnd", $hGfx, "hwnd", $hBmp_Glow, "int", 0, "int", 0, "int", $iWidth, "int", $iHeight, "int", 0, "int", 0, "int", $iWidth, "int", $iHeight, "int", 2, "ptr", $hImgAttrib, "int", 0, "int", 0)

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

    DllCall($ghGDIPDll, "int", "GdipDisposeImageAttributes", "ptr", $hImgAttrib)

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

    Local $iInfW = _GDIPlus_ImageGetWidth($aInfo[0])
    Local $iInfH = _GDIPlus_ImageGetHeight($aInfo[0])
    _GDIPlus_GraphicsDrawImage($hGfxBuffer, $aInfo[0], $iWidth / 2 - $iInfW / 2, $iHeight - $iInfH - 30)

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

    Local $hClone
    If Random(0, 300, 1) = 0 Then
    $aResult = DllCall($ghGDIPDll, "uint", "GdipClonePath", "hwnd", $aAutoIt[2], "hwnd*", 0)
    $hClone = $aResult[2]
    DllCall($ghGDIPDll, "uint", "GdipTransformPath", "hwnd", $hClone, "hwnd", $hMatrix)
    Local $hPen = _GDIPlus_PenCreate(0xAA000000, 8)
    DllCall($ghGDIPDll, "uint", "GdipDrawPath", "hwnd", $hGfx, "hwnd", $hPen, "hwnd", $hClone)
    _GDIPlus_PenDispose($hPen)
    DllCall($ghGDIPDll, "uint", "GdipDeletePath", "hwnd", $hClone)
    EndIf

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

    $aResult = DllCall($ghGDIPDll, "uint", "GdipClonePath", "hwnd", $aAutoIt[1], "hwnd*", 0)
    $hClone = $aResult[2]
    DllCall($ghGDIPDll, "uint", "GdipTransformPath", "hwnd", $hClone, "hwnd", $hMatrix)

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

    Local $hPen_Glow = _GDIPlus_PenCreate(0x30FFEEFF, 3)
    DllCall($ghGDIPDll, "uint", "GdipDrawPath", "hwnd", $hGfx, "hwnd", $hPen_Glow, "hwnd", $hClone)
    _GDIPlus_PenDispose($hPen_Glow)

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

    _GDIPlus_GraphicsDispose($hGfx)

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

    _GDIPlus_GraphicsDrawImage($hGfxBuffer, $hBMP, 0, 0)
    _GDIPlus_BitmapDispose($hBmp_Glow)
    $hBmp_Glow = $hBMP

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

    DllCall($ghGDIPDll, "uint", "GdipResetLineTransform", "hwnd", $hBrush_Light)
    DllCall($ghGDIPDll, "uint", "GdipRotateLineTransform", "hwnd", $hBrush_Light, "float", 80, "int", 1)
    DllCall($ghGDIPDll, "uint", "GdipScaleLineTransform", "hwnd", $hBrush_Light, "float", 1 + Sin($fLight) * 0.2, "float", 1 + Sin($fLight) * 0.2, "int", 1)

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

    DllCall($ghGDIPDll, "uint", "GdipFillPath", "hwnd", $hGfxBuffer, "hwnd", $hBrush_Light, "hwnd", $hClone)
    DllCall($ghGDIPDll, "uint", "GdipDeletePath", "hwnd", $hClone)

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

    DllCall($ghGDIPDll, "uint", "GdipFillPath", "hwnd", $hGfxBuffer, "hwnd", $hBrush_Light, "hwnd", $aInfo[1])

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

    _GDIPlus_MatrixDispose($hMatrix)

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

    _WinAPI_BitBlt($hDC, 0, 0, $iWidth, $iHeight, $hCDC, 0, 0, 0x00CC0020)
    EndFunc ;==>_Draw

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

    Func _CreateAutoItBitmap($aAutoIt, $aAutoIt_Dim, $hBmp_Alu)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $aAutoIt_Dim[2] + 20, "int", $aAutoIt_Dim[3] + 20, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
    If @error Then Return SetError(1, 3, False)
    Local $hBMP = $aResult[6]
    Local $hGfx = _GDIPlus_ImageGetGraphicsContext($hBMP)
    _GDIPlus_GraphicsSetSmoothingMode($hGfx, 2)

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

    Local $hBrush_Alu_1 = _CreateAlu_Brush($hBmp_Alu, 0.75, 0.8, 0.75)
    Local $hBrush_Alu_2 = _CreateAlu_Brush($hBmp_Alu, 0.1, 0.3, 0.8)
    Local $hBrush_Alu_3 = _CreateAlu_Brush($hBmp_Alu, 0.64, 0.1, 0.1)

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

    DllCall($ghGDIPDll, "uint", "GdipFillPath", "hwnd", $hGfx, "hwnd", $hBrush_Alu_1, "hwnd", $aAutoIt[1])
    DllCall($ghGDIPDll, "uint", "GdipFillPath", "hwnd", $hGfx, "hwnd", $hBrush_Alu_2, "hwnd", $aAutoIt[4])
    DllCall($ghGDIPDll, "uint", "GdipFillPath", "hwnd", $hGfx, "hwnd", $hBrush_Alu_3, "hwnd", $aAutoIt[5])
    _GDIPlus_BrushDispose($hBrush_Alu_1)
    _GDIPlus_BrushDispose($hBrush_Alu_2)
    _GDIPlus_BrushDispose($hBrush_Alu_3)

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

    Local $aGlowColor[6] = [0, 0, 0x00EEFFEE, 0x00DDFFDD, 0x006688FF, 0x00FF6666]
    Local $aGlowSize[6] = [0, 0, 16, 14, 14, 10]

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

    Local $hPen_Glow = _GDIPlus_PenCreate()
    DllCall($ghGDIPDll, "uint", "GdipSetPenLineJoin", "hwnd", $hPen_Glow, "int", 1)

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

    For $i = 2 To $aAutoIt[0]
    _GDIPlus_PenSetColor($hPen_Glow, BitOR(0x14000000, $aGlowColor[$i]))

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

    For $j = 1 To $aGlowSize[$i] Step 2
    _GDIPlus_PenSetWidth($hPen_Glow, $aGlowSize[$i] + 3 - $j)
    DllCall($ghGDIPDll, "uint", "GdipDrawPath", "hwnd", $hGfx, "hwnd", $hPen_Glow, "hwnd", $aAutoIt[$i])
    Next

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

    _GDIPlus_PenSetWidth($hPen_Glow, 2)
    _GDIPlus_PenSetColor($hPen_Glow, BitOR(0xDD000000, $aGlowColor[$i]))
    DllCall($ghGDIPDll, "uint", "GdipDrawPath", "hwnd", $hGfx, "hwnd", $hPen_Glow, "hwnd", $aAutoIt[$i])
    Next

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

    _GDIPlus_PenDispose($hPen_Glow)

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

    _GDIPlus_GraphicsDispose($hGfx)

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

    Return $hBMP
    EndFunc ;==>_CreateAutoItBitmap

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

    Func _CreateInfoBitmap()
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreatePath", "int", 0, "int*", 0)
    If @error Then Return SetError(1, 1, False)
    Local $hPath = $aResult[2]

    [/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]

    DllCall($ghGDIPDll, "uint", "GdipAddPathString", "hwnd", $hPath, "wstr", "AutoIt GDI+ Script by Eukalyptus", "int", -1, "hwnd", $hFamily, "int", 0, "float", 13, "ptr", DllStructGetPtr($tLayout), "hwnd", $hFormat)

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

    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)

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

    Local $tBounds = _GDIPlus_RectFCreate(0, 0, 0, 0)
    DllCall($ghGDIPDll, "uint", "GdipGetPathWorldBounds", "hwnd", $hPath, "ptr", DllStructGetPtr($tBounds), "hwnd", 0, "hwnd", 0)

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

    Local $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixTranslate($hMatrix, -DllStructGetData($tBounds, "X") + 10, -DllStructGetData($tBounds, "Y") + 10, 0)
    DllCall($ghGDIPDll, "uint", "GdipTransformPath", "hwnd", $hPath, "hwnd", $hMatrix)
    _GDIPlus_MatrixDispose($hMatrix)

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

    Local $iImgW = DllStructGetData($tBounds, "Width") + 20
    Local $iImgH = DllStructGetData($tBounds, "Height") + 20
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iImgW, "int", $iImgH, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
    If @error Then Return SetError(1, 3, False)
    Local $hBMP = $aResult[6]
    Local $hGfx = _GDIPlus_ImageGetGraphicsContext($hBMP)
    _GDIPlus_GraphicsSetSmoothingMode($hGfx, 2)

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

    Local $hPen = _GDIPlus_PenCreate(0x0444FFAA)
    DllCall($ghGDIPDll, "uint", "GdipSetPenLineJoin", "hwnd", $hPen, "int", 1)
    For $i = 12 To 1 Step -1
    _GDIPlus_PenSetWidth($hPen, $i)
    DllCall($ghGDIPDll, "uint", "GdipDrawPath", "hwnd", $hGfx, "hwnd", $hPen, "hwnd", $hPath)
    Next
    _GDIPlus_PenSetWidth($hPen, 1)
    _GDIPlus_PenSetColor($hPen, 0xFF88DD88)
    DllCall($ghGDIPDll, "uint", "GdipDrawPath", "hwnd", $hGfx, "hwnd", $hPen, "hwnd", $hPath)

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

    Local $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    DllCall($ghGDIPDll, "uint", "GdipFillPath", "hwnd", $hGfx, "hwnd", $hBrush, "hwnd", $hPath)
    _GDIPlus_BrushDispose($hBrush)

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

    _GDIPlus_PenSetWidth($hPen, 2)
    DllCall($ghGDIPDll, "uint", "GdipWidenPath", "hwnd", $hPath, "hwnd", $hPen, "hwnd", 0, "float", 0.1)
    _GDIPlus_PenDispose($hPen)

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

    _GDIPlus_GraphicsDispose($hGfx)

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

    Local $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixTranslate($hMatrix, $iWidth / 2 - $iImgW / 2, $iHeight - $iImgH - 30, 0)
    DllCall($ghGDIPDll, "uint", "GdipTransformPath", "hwnd", $hPath, "hwnd", $hMatrix)
    _GDIPlus_MatrixDispose($hMatrix)

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

    Local $aReturn[2]
    $aReturn[0] = $hBMP
    $aReturn[1] = $hPath
    Return $aReturn
    EndFunc ;==>_CreateInfoBitmap

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

    Func _CreateLight_Brush($fSize, $iLightColor = 0xAAFFFFFF, $fLightScale = 1.3)
    Local $tPointF1 = DllStructCreate("float; float;")
    Local $tPointF2 = DllStructCreate("float; float;")
    DllStructSetData($tPointF2, 2, $fSize * $fLightScale)

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

    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateLineBrush", "ptr", DllStructGetPtr($tPointF1), "ptr", DllStructGetPtr($tPointF2), "uint", 0, "uint", $iLightColor, "int", 0, "int*", 0)
    If @error Or Not IsArray($aResult) Then Return SetError(1, 4, False)
    Local $hBrush = $aResult[6]

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

    DllCall($ghGDIPDll, "uint", "GdipSetLineSigmaBlend", "hwnd", $hBrush, "float", 0.5, "float", 1)
    DllCall($ghGDIPDll, "uint", "GdipSetLineGammaCorrection", "hwnd", $hBrush, "int", True)

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

    Return $hBrush
    EndFunc ;==>_CreateLight_Brush

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

    Func _CreateAlu_Brush($hBmp_Alu, $fRed = 1, $fGreen = 1, $fBlue = 1)
    Local $iImgW = _GDIPlus_ImageGetWidth($hBmp_Alu)
    Local $iImgH = _GDIPlus_ImageGetHeight($hBmp_Alu)

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

    Local $tColorMatrix = DllStructCreate("float[5]; float[5]; float[5]; float[5]; float[5];")
    DllStructSetData($tColorMatrix, 1, $fRed, 1)
    DllStructSetData($tColorMatrix, 2, $fGreen, 2)
    DllStructSetData($tColorMatrix, 3, $fBlue, 3)
    DllStructSetData($tColorMatrix, 4, 1, 4)
    DllStructSetData($tColorMatrix, 5, 1, 5)

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

    Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreateImageAttributes", "ptr*", 0)
    If @error Then Return SetError(1, 4, False)
    Local $hImgAttrib = $aResult[1]
    DllCall($ghGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", 1, "int", 1, "ptr", DllStructGetPtr($tColorMatrix), "ptr", 0, "int", 0)

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

    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateTextureIA", "hwnd", $hBmp_Alu, "hwnd", $hImgAttrib, "float", 0, "float", 0, "float", $iImgW, "float", $iImgH, "int*", 0)
    If @error Then Return SetError(1, 1, False)
    Local $hBrush = $aResult[7]

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

    DllCall($ghGDIPDll, "int", "GdipDisposeImageAttributes", "ptr", $hImgAttrib)

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

    Return $hBrush
    EndFunc ;==>_CreateAlu_Brush

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

    Func _CalcLogoDim($aAutoIt)
    Local $aDim[10]
    Local $tBounds = _GDIPlus_RectFCreate(0, 0, 0, 0)
    Local $pBounds = DllStructGetPtr($tBounds)

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

    DllCall($ghGDIPDll, "uint", "GdipGetPathWorldBounds", "hwnd", $aAutoIt[1], "ptr", $pBounds, "hwnd", 0, "hwnd", 0)
    $aDim[0] = DllStructGetData($tBounds, "X")
    $aDim[1] = DllStructGetData($tBounds, "Y")
    $aDim[2] = DllStructGetData($tBounds, "Width")
    $aDim[3] = DllStructGetData($tBounds, "Height")

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

    DllCall($ghGDIPDll, "uint", "GdipGetPathWorldBounds", "hwnd", $aAutoIt[3], "ptr", $pBounds, "hwnd", 0, "hwnd", 0)
    $aDim[4] = DllStructGetData($tBounds, "X")
    $aDim[5] = DllStructGetData($tBounds, "Y")
    $aDim[6] = DllStructGetData($tBounds, "Width")
    $aDim[7] = DllStructGetData($tBounds, "Height")

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

    $aDim[8] = ($aDim[2] - $aDim[6] / 2) + $aDim[4]
    $aDim[9] = ($aDim[3] - $aDim[7] / 2) + $aDim[4]

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

    Return $aDim
    EndFunc ;==>_CalcLogoDim

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

    Func _CreateAutoItLogo()
    Local $bLogo = "0x6A0000006E2D404317F67B4108CA624333A77B410C9E8143C649C7417BA08F4303B02342CA4C9343F3C38B41A23F9E43D31AF13ECB2CAB43D31AF13E8523BB43D31AF13EAF10C8430797D241AF10C84353016942AF10C843A57DA8429A78BF433E79D442C4ACB34341FAE242F07DBB43B7450D432FF7BF43474B2D432FF7BF43556F4F432FF7BF43C8AB9C43D50A95432198C7436E2D40432198C74381A2AC422198C743D31AF13EC8AB9C43D31AF13E556F4F43D31AF13E4D26CB4281A2AC4233A77B416E2D404333A77B416E2D4043FCD2B343BDE18943AF9AB343BBF9AB43B0829143BBF9AB43556F4F43BBF9AB438FB2F742BDE1894364D55E426E2D404364D55E42C32ED94264D55E42CDCD21428FB2F742CDCD2142556F4F43CDCD2142B0829143C32ED942AF9AB3436E2D4043AF9AB34319730E43D4E5834317D2174326C27A43163121433C0B6E4305842A43444861437FDA36434448614348BD5E439AB76043A5FB6A43D1C06143C4DB6043AFD95443C1D44943F824324326CA404380F52443883E294302C84543F7BE114390A66643CE7EF44288BC8343D4DBCF4288BC8343BD20AB4288BC8343C37D864288BC83431CB9C64296BC5A433B7A03430DF42D43E797234393370143BCA633433B2BD64246634F4392C1D442F24D5F4393370143AF9E7E430DF42D43AEF18E4396BC5A430B9A9E4388BC8343E179814388BC83436EB3484388BC834319730E4388BC8343E52DA043B9B0374279C8A543367737420B63AB43367737429EFDB04336773742582BB443367737427543B443D2B450429EFDB043D2B45042DF17AC43D2B45042192CA743D2B450425B46A243D2B45042E091A3434AE45D426CE3A443C2136B42F834A64300137842A57DA843001378420858B14321A075427E97B24318B67A427D70B3434B4A7E4212EFB343C12F8842C11BB143C12F8842B741AA43C12F8842AD67A343C12F88429E879C43C12F88428C2D9E430719904274CD9F436C1A98425C6DA143D01BA042F255A543D01BA0425DA0B143233DA14209C2B443EF819E42E750BC4317D29742139CBB43D0CC7242C516B743ACBE6642990EBC43DBD15B42BB05BD43BBC61B4241CBB5439D540C423055B243FFFB0442D01BA043C12F084234549B43C12F08421DF49C434F021842FE8D9E43DFD42742E52DA04336773742000303030303030303030303030303030303030303030303830003030303030303030303038300030303030303030303030303030303030303030303030303030383000303030303030303030303030303030303030303030303030303030303030303030303030303830000"

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

    Local $tLogo = DllStructCreate("byte[" & BinaryLen($bLogo) & "];")
    DllStructSetData($tLogo, 1, $bLogo)
    Local $tCnt = DllStructCreate("uint", DllStructGetPtr($tLogo))
    Local $iPathCnt = DllStructGetData($tCnt, 1)
    Local $tPathData = DllStructCreate("uint Cnt; float Pnt[" & $iPathCnt * 2 & "]; ubyte Type[" & $iPathCnt & "];", DllStructGetPtr($tLogo))

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

    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreatePath2", "ptr", DllStructGetPtr($tPathData, "Pnt"), "ptr", DllStructGetPtr($tPathData, "Type"), "int", $iPathCnt, "int", 0, "int*", 0)
    If @error Then Return SetError(1, 1, False)
    Local $hPath = $aResult[5]

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

    Local $tBounds = _GDIPlus_RectFCreate(0, 0, 0, 0)
    Local $pBounds = DllStructGetPtr($tBounds)

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

    DllCall($ghGDIPDll, "uint", "GdipGetPathWorldBounds", "hwnd", $hPath, "ptr", $pBounds, "hwnd", 0, "hwnd", 0)
    Local $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixTranslate($hMatrix, -DllStructGetData($tBounds, "X") + 10, -DllStructGetData($tBounds, "Y") + 10, 0)
    DllCall($ghGDIPDll, "uint", "GdipTransformPath", "hwnd", $hPath, "hwnd", $hMatrix)
    _GDIPlus_MatrixDispose($hMatrix)

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

    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreatePathIter", "int*", 0, "hwnd", $hPath)
    If @error Then Return SetError(1, 2, False)
    Local $hPathIter = $aResult[1]

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

    $aResult = DllCall($ghGDIPDll, "uint", "GdipPathIterGetSubpathCount", "hwnd", $hPathIter, "int*", 0)
    If @error Then Return SetError(1, 3, False)
    Local $iPathIter = $aResult[2]

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

    Local $aReturn[$iPathIter + 2] = [$iPathIter + 1]
    For $i = 1 To $iPathIter
    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreatePath", "int", 0, "int*", 0)
    If @error Then Return SetError(1, 4, False)
    $aReturn[$i + 1] = $aResult[2]
    DllCall($ghGDIPDll, "uint", "GdipPathIterNextSubpathPath", "hwnd", $hPathIter, "int*", 0, "hwnd", $aReturn[$i + 1], "int*", 0)
    Next
    DllCall($ghGDIPDll, "uint", "GdipDeletePathIter", "hwnd", $hPathIter)

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

    $aReturn[1] = $hPath

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

    Return $aReturn
    EndFunc ;==>_CreateAutoItLogo

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

    Func _CreateAlu($iW, $iH, $iBlurDist = 14, $fBlurTrans = 0.6)
    $iBlurDist = Ceiling($iBlurDist)
    $iBlurDist += 1 - Mod($iBlurDist, 2)

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

    Local $iOverSize = 0
    For $i = 1 To $iBlurDist Step 2
    $iOverSize += $i + $i + 1
    Next

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

    Local $iWO = $iW + $iOverSize

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

    Local $iNoiseSize = 40

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

    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iNoiseSize, "int", $iNoiseSize, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
    If @error Or Not IsArray($aResult) Then Return SetError(1, 1, False)
    Local $hBmp_Noise = $aResult[6]
    Local $hGfx_Noise = _GDIPlus_ImageGetGraphicsContext($hBmp_Noise)

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

    Local $tData = _GDIPlus_BitmapLockBits($hBmp_Noise, 0, 0, $iNoiseSize, $iNoiseSize, BitOR($GDIP_ILMREAD, $GDIP_ILMWRITE), $GDIP_PXF32ARGB)
    Local $iStride = DllStructGetData($tData, "Stride")
    Local $iWidth = DllStructGetData($tData, "Width")
    Local $iHeight = DllStructGetData($tData, "Height")
    Local $pScan0 = DllStructGetData($tData, "Scan0")
    Local $tPixel = DllStructCreate("dword[" & $iWidth * $iHeight & "];", $pScan0)

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

    Local $iAmp
    For $row = 0 To $iHeight - 1
    For $col = 0 To $iWidth - 1
    $iAmp = Random(0, 0xFF, 1)
    DllStructSetData($tPixel, 1, BitOR(0xFF000000, BitShift($iAmp, -16), BitShift($iAmp, -8), $iAmp), $row * $iWidth + $col + 1)
    Next
    Next

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

    _GDIPlus_BitmapUnlockBits($hBmp_Noise, $tData)

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

    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWO, "int", $iH, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
    If @error Or Not IsArray($aResult) Then Return SetError(1, 3, False)
    Local $hBmp_Full = $aResult[6]
    Local $hGfx_Full = _GDIPlus_ImageGetGraphicsContext($hBmp_Full)
    _GDIPlus_GraphicsSetSmoothingMode($hGfx_Full, 2)
    DllCall($ghGDIPDll, "uint", "GdipSetInterpolationMode", "hwnd", $hGfx_Full, "int", 7)

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

    Local $iXOff, $iYOff, $iSizeX, $iSizeY
    For $y = 0 To $iH Step $iNoiseSize / 2
    For $x = 0 To $iWO Step $iNoiseSize / 2
    $iXOff = Random(0, $iNoiseSize / 2, 1)
    $iYOff = Random(0, $iNoiseSize / 2, 1)
    $iSizeX = $iNoiseSize - $iXOff
    $iSizeY = $iNoiseSize - $iYOff
    _GDIPlus_GraphicsDrawImageRectRect($hGfx_Full, $hBmp_Noise, $iXOff, $iYOff, $iSizeX, $iSizeY, $x, $y, $iSizeX, $iSizeY)
    Next
    Next

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

    _GDIPlus_GraphicsDispose($hGfx_Noise)
    _GDIPlus_BitmapDispose($hBmp_Noise)

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

    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWO, "int", $iH, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
    If @error Or Not IsArray($aResult) Then Return SetError(1, 3, False)
    Local $hBmp_Full2 = $aResult[6]
    Local $hGfx_Full2 = _GDIPlus_ImageGetGraphicsContext($hBmp_Full2)
    _GDIPlus_GraphicsSetSmoothingMode($hGfx_Full2, 2)
    DllCall($ghGDIPDll, "uint", "GdipSetInterpolationMode", "hwnd", $hGfx_Full2, "int", 7)

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

    Local $tColorMatrix = DllStructCreate("float[5]; float[5]; float[5]; float[5]; float[5];")
    DllStructSetData($tColorMatrix, 1, 1, 1)
    DllStructSetData($tColorMatrix, 2, 1, 2)
    DllStructSetData($tColorMatrix, 3, 1, 3)
    DllStructSetData($tColorMatrix, 4, $fBlurTrans, 4)
    DllStructSetData($tColorMatrix, 5, 1, 5)

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

    $aResult = DllCall($ghGDIPDll, "int", "GdipCreateImageAttributes", "ptr*", 0)
    If @error Or Not IsArray($aResult) Then Return SetError(1, 4, False)
    Local $hImgAttrib = $aResult[1]
    DllCall($ghGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", 1, "int", 1, "ptr", DllStructGetPtr($tColorMatrix), "ptr", 0, "int", 0)

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

    For $i = 1 To $iBlurDist Step 2
    DllCall($ghGDIPDll, "int", "GdipDrawImageRectRectI", "hwnd", $hGfx_Full2, "hwnd", $hBmp_Full, "int", $i, "int", 0, "int", $iWO, "int", $iH, "int", 0, "int", 0, "int", $iWO, "int", $iH, "int", 2, "ptr", $hImgAttrib, "int", 0, "int", 0)
    DllCall($ghGDIPDll, "int", "GdipDrawImageRectRectI", "hwnd", $hGfx_Full, "hwnd", $hBmp_Full2, "int", $i + 1, "int", 0, "int", $iWO, "int", $iH, "int", 0, "int", 0, "int", $iWO, "int", $iH, "int", 2, "ptr", $hImgAttrib, "int", 0, "int", 0)
    Next
    DllCall($ghGDIPDll, "int", "GdipDisposeImageAttributes", "ptr", $hImgAttrib)

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

    _GDIPlus_GraphicsDispose($hGfx_Full2)
    _GDIPlus_BitmapDispose($hBmp_Full2)
    _GDIPlus_GraphicsDispose($hGfx_Full)

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

    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iW, "int", $iH, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
    If @error Or Not IsArray($aResult) Then Return SetError(1, 3, False)
    Local $hBmp_Alu = $aResult[6]
    Local $hGfx_Alu = _GDIPlus_ImageGetGraphicsContext($hBmp_Alu)
    _GDIPlus_GraphicsSetSmoothingMode($hGfx_Alu, 2)
    DllCall($ghGDIPDll, "uint", "GdipSetInterpolationMode", "hwnd", $hGfx_Alu, "int", 7)

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

    _GDIPlus_GraphicsDrawImage($hGfx_Alu, $hBmp_Full, -$iOverSize, 0)
    _GDIPlus_BitmapDispose($hBmp_Full)
    _GDIPlus_GraphicsDispose($hGfx_Alu)

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

    Return $hBmp_Alu
    EndFunc ;==>_CreateAlu

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

    Func _WM_PAINT($hWnd, $iMsg, $wParam, $lParam)
    _WinAPI_BitBlt($hDC, 0, 0, $iWidth, $iHeight, $hCDC, 0, 0, 0x00CC0020)
    Return $GUI_RUNDEFMSG
    EndFunc ;==>_WM_PAINT

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

    Func _Exit()
    For $i = 1 To $aAutoIt[0]
    DllCall($ghGDIPDll, "uint", "GdipDeletePath", "hwnd", $aAutoIt[$i])
    Next
    DllCall($ghGDIPDll, "uint", "GdipDeletePath", "hwnd", $aInfo[1])

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

    _GDIPlus_BitmapDispose($hBmp_Alu)
    _GDIPlus_BitmapDispose($hBmp_AutoIt)
    _GDIPlus_BitmapDispose($hBmp_Glow)
    _GDIPlus_BitmapDispose($aInfo[0])

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

    _GDIPlus_BrushDispose($hBrush_Light)

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

    _GDIPlus_GraphicsDispose($hGfxBuffer)
    _WinAPI_SelectObject($hCDC, $hOBJ)
    _WinAPI_DeleteObject($hBMP)
    _WinAPI_DeleteDC($hCDC)
    _WinAPI_ReleaseDC($hGui, $hDC)
    _GDIPlus_Shutdown()
    GUIDelete($hGui)
    Exit
    EndFunc ;==>_Exit

    [/autoit]

    E

  • Sieht echt nice aus :thumbup:
    Respekt!

    MfG

    There's a joke that C has the speed and efficieny of assembly language combined with readability of....assembly language. In other words, it's just a glorified assembly language. - Teh Interwebz

    C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, you blow off your whole leg. - Bjarne Stroustrup
    Genie zu sein, bedeutet für mich, alles zu tun, was ich will. - Klaus Kinski

    • Offizieller Beitrag

    Goil. 8o:thumbup:


    AAAAAMMMMIIIIGGGGAAAAA :D

  • Sieht klasse aus! 8o Was du alles aus GDI+ heraus kitzelst, ist schon krass! :thumbup:

    Was hattest du denn eigentlich machen wollen?

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

  • Sehr schön !
    Auch interessante Funktionen wie AluBrush, CreateAlu und LightBrush sind vorhanden.
    Hier kann man was lernen :P

  • Was hattest du denn eigentlich machen wollen?


    Ich wollte das Logo in 3D machen und an den Kanten sollten Lichteffekte entlanglaufen.

    Gibts das auch als Bildschirmschoner :D?


    Könnte man leicht draus machen, allerdings sollte man das Script vorher noch etwas optimieren.

    Auch interessante Funktionen wie AluBrush, CreateAlu und LightBrush sind vorhanden.


    Wie man Aluminium erstellt, hab ich hier gezeigt: GDIPlus gebürstetes Aluminium ;)
    Mit der Funktion _CreateAlu_Brush kann man aus diesem Bitmap einen Brush in jedem beliebigen Farbton erstellen.

    Ganz interessant sind auch die einzelnen Bilder, aus denen das fertige Bild entsteht - einfach von den Zeilen 76, 135 u 144 jeweils zwei auskommentieren.

    E

  • SUPERFREAK :D Das sieht so hammer aus, ich hätte ja beinahe darauf geschworen das man mit AutoIt mehr als ne Klötzchen Grafik net hinkriegt aber nun bin ich überzeugt worden :D

    Grüße Yaerox

    Grüne Hölle