Hallo, meine Lieben!
Die letzten Monate hatte ich kaum Zeit für das Forum.
Dieser Zustand wird auch noch ein paar Monate anhalten...
Quasi als Entschuldigung hab ich hier ein Script für euch:
Spoiler anzeigen
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global Const $cPI = ATan(1) * 4
Global Const $c2PI = $cPI * 2
Global Const $cPI2 = $cPI / 2
Global Const $LENS = 2000
[/autoit] [autoit][/autoit] [autoit]Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)
Global $iWidth = 800
Global $iHeight = 600
_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]ProgressOn("Please wait...", "creating big firework... 1/3")
Global $aFW_B = _FireWork_Create($iWidth / 2, $iHeight / 2, 180, 7, 0xFFFFFFFF, $iWidth, $iHeight)
ProgressOn("Please wait...", "creating mid firework... 2/3")
Global $aFW_M = _FireWork_Create($iHeight / 2, $iHeight / 2, 120, 5, 0xFFFFFFFF, $iWidth, $iHeight)
ProgressOn("Please wait...", "creating small firework... 3/3")
Global $aFW_S = _FireWork_Create($iHeight / 2, $iHeight / 2, 60, 3, 0xFFFFFFFF, $iWidth, $iHeight)
ProgressOff()
Global $hGui = GUICreate("FireWork", $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_GraphicsClear($hGfxBuffer, 0xFF000000)
Global $hBmpBG = _CreateBackGround()
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]GUIRegisterMsg($WM_PAINT, "WM_PAINT")
GUIRegisterMsg($WM_ERASEBKGND, "WM_PAINT")
GUISetState()
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]Global $aAttrib = _CreateImageAttributes()
Global $tColorMX = DllStructCreate("float[5]; float[5]; float[5]; float[5]; float[5];")
DllStructSetData($tColorMX, 1, 1, 1)
DllStructSetData($tColorMX, 2, 1, 2)
DllStructSetData($tColorMX, 3, 1, 3)
DllStructSetData($tColorMX, 4, 1, 4)
DllStructSetData($tColorMX, 5, 1, 5)
Global $iTimer = TimerInit()
While 1
If TimerDiff($iTimer) >= 20 Then
$iTimer = TimerInit()
_Draw()
EndIf
WEnd
Func _CreateImageAttributes()
Local $aAttrib[7]
Local $aResult
For $i = 1 To 6
$aResult = DllCall($ghGDIPDll, "int", "GdipCreateImageAttributes", "ptr*", 0)
$aAttrib[$i] = $aResult[1]
Next
Return $aAttrib
EndFunc ;==>_CreateImageAttributes
Func _FireWork_Create($fCX, $fCY, $iCnt, $fSpeed, $iColor, $iW, $iH)
Local $aExp[$iCnt + 1][40] = [[$iCnt]]
Local $fPhi, $fTheta
Local $fVX, $fVY, $fVZ, $fD
For $i = 1 To $iCnt
$fPhi = Random(0, $cPI2)
$fTheta = Random(0, $c2PI)
$fVX = Sin($fPhi) * Cos($fTheta) * $fSpeed
$fVY = Sin($fPhi) * Sin($fTheta) * $fSpeed
$fVZ = Cos($fPhi) * $fSpeed
$fD = ($LENS - $fVZ)
[/autoit] [autoit][/autoit] [autoit]$aExp[$i][0] = $fCX
$aExp[$i][1] = $fCY
$aExp[$i][2] = $LENS * $fVX / $fD
$aExp[$i][3] = $LENS * $fVY / $fD
$aExp[$i][4] = Random(70, 122, 1)
$aExp[$i][5] = Random(0.4, 1.6)
For $j = 0 To 32 Step 2
$aExp[$i][6 + $j] = $fCX
$aExp[$i][7 + $j] = $fCY
Next
Next
Local $aFW[129]
Local $fX, $fY, $fR, $fTX, $fTY
Local $hContext, $hBitmap
Local $hPen = _GDIPlus_PenCreate($iColor, 1)
Local $hBrush = _GDIPlus_BrushCreateSolid(BitOR(0x08000000, BitAND($iColor, 0x00FFFFFF)))
Local $tCMX = DllStructCreate("float[5]; float[5]; float[5]; float[5]; float[5];")
DllStructSetData($tCMX, 1, 1, 1)
DllStructSetData($tCMX, 2, 1, 2)
DllStructSetData($tCMX, 3, 1, 3)
DllStructSetData($tCMX, 4, 0.85, 4)
DllStructSetData($tCMX, 5, 1, 5)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreateImageAttributes", "ptr*", 0)
Local $hAttr = $aResult[1]
DllCall($ghGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hAttr, "int", 1, "int", 1, "ptr", DllStructGetPtr($tCMX), "ptr", 0, "int", 0)
Local $fSW = $fSpeed / 3
Local $fSW2 = $fSW * 1.5, $fSW4 = $fSW * 3
Local $aLog[33]
For $i = 0 To 32 Step 2
$aLog[$i] = Log($i * 5 / 32 + 2) * $fSW
Next
For $iStep = 1 To 128
ProgressSet($iStep / 128 * 100)
For $i = 1 To $iCnt
$aExp[$i][2] += -$aExp[$i][2] / 48
$aExp[$i][3] += ($aExp[$i][5] - $aExp[$i][3]) / 48
For $j = 32 To 2 Step -2
$aExp[$i][6 + $j] = $aExp[$i][4 + $j]
$aExp[$i][7 + $j] = $aExp[$i][5 + $j]
Next
$aExp[$i][6] = $aExp[$i][0]
$aExp[$i][7] = $aExp[$i][1]
$aExp[$i][0] += $aExp[$i][2]
$aExp[$i][1] += $aExp[$i][3]
Next
$aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iW, "int", $iH, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
$hBitmap = $aResult[6]
$aFW[$iStep] = $hBitmap
$hContext = _GDIPlus_ImageGetGraphicsContext($aFW[$iStep])
_GDIPlus_GraphicsSetSmoothingMode($hContext, 2)
DllCall($ghGDIPDll, "int", "GdipDrawImageRectRectI", "hwnd", $hContext, "hwnd", $aFW[$iStep - 1], "int", 0, "int", 0, "int", $iW, "int", $iH, "int", 0, "int", 0, "int", $iW, "int", $iH, "int", 2, "ptr", $hAttr, "int", 0, "int", 0)
[/autoit] [autoit][/autoit] [autoit]For $i = 1 To $aExp[0][0]
If $iStep > $aExp[$i][4] Then ContinueLoop
$fX = $aExp[$i][0] + Random(-1, 1)
$fY = $aExp[$i][1] + Random(-1, 1)
;DllCall($ghGDIPDll, "int", "GdipDrawEllipse", "handle", $hContext, "handle", $hPen, "float", $fX, "float", $fY, "float", 1, "float", 1)
DllCall($ghGDIPDll, "uint", "GdipBitmapSetPixel", "hwnd", $hBitmap, "int", $fX, "int", $fY, "uint", $iColor)
For $j = 0 To 32 Step 2
$fR = $aLog[$j];Log($j * 5 / 32 + 2) * $fSW
$fX = $aExp[$i][6 + $j] + Random(-$fR, $fR)
$fY = $aExp[$i][7 + $j] + Random(-$fR, $fR)
If (76 - $j) - $iStep > 0 Then
;DllCall($ghGDIPDll, "int", "GdipFillEllipse", "handle", $hContext, "handle", $hBrush, "float", $fX - $fSW2, "float", $fY - $fSW2, "float", $fSW4, "float", $fSW4)
DllCall($ghGDIPDll, "int", "GdipFillRectangle", "handle", $hContext, "handle", $hBrush, "float", $fX - $fSW2, "float", $fY - $fSW2, "float", $fSW4, "float", $fSW4)
;DllCall($ghGDIPDll, "int", "GdipDrawEllipse", "handle", $hContext, "handle", $hPen, "float", $fX, "float", $fY, "float", 1, "float", 1)
DllCall($ghGDIPDll, "uint", "GdipBitmapSetPixel", "hwnd", $hBitmap, "int", $fX, "int", $fY, "uint", $iColor)
EndIf
Next
Next
_GDIPlus_GraphicsDispose($hContext)
Next
DllCall($ghGDIPDll, "int", "GdipDisposeImageAttributes", "ptr", $hAttr)
_GDIPlus_PenDispose($hPen)
_GDIPlus_BrushDispose($hBrush)
$aFW[0] = 128
Return $aFW
EndFunc ;==>_FireWork_Create
Func _FireWork_Dispose(ByRef $aFW)
If Not IsArray($aFW) Then Return
For $i = 1 To $aFW[0]
_GDIPlus_BitmapDispose($aFW[$i])
Next
$aFW = 0
EndFunc ;==>_FireWork_Dispose
Func _CreateBackGround()
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
Local $hBitmap = $aResult[6]
Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($hContext, 2)
_GDIPlus_GraphicsClear($hContext, 0xFF00000A)
Local $hBrush1 = _GDIPlus_BrushCreateSolid(0x88FFFFFF)
Local $hBrush2 = _GDIPlus_BrushCreateSolid(0x02FFFFFF)
Local $fX, $fY, $fR, $fR1
For $i = 1 To 250
$fX = Random(0, $iWidth)
$fY = Random(0, $iHeight)
$fR = Random(0.2, 2.5)
$fR1 = $fR * 4
DllCall($ghGDIPDll, "int", "GdipFillEllipse", "handle", $hContext, "handle", $hBrush2, "float", $fX - $fR1, "float", $fY - $fR1, "float", $fR1 + $fR1, "float", $fR1 + $fR1)
DllCall($ghGDIPDll, "int", "GdipFillEllipse", "handle", $hContext, "handle", $hBrush1, "float", $fX - $fR, "float", $fY - $fR, "float", $fR + $fR, "float", $fR + $fR)
Next
_GDIPlus_BrushDispose($hBrush1)
_GDIPlus_BrushDispose($hBrush2)
_GDIPlus_GraphicsDispose($hContext)
Return $hBitmap
EndFunc ;==>_CreateBackGround
Func _Draw()
Local Static $aStep[7] = [0, 5000, 129, 129, 129, 129, 129], $aWait[7] = [0, Random(140, 500, 1), Random(140, 500, 1), Random(140, 500, 1), Random(400, 1000, 1), Random(400, 1000, 1), Random(400, 1000, 1)]
Local Static $aPos[7][2]
Local $fR, $fG, $fB
[/autoit] [autoit][/autoit] [autoit]For $i = 1 To 6
$aStep[$i] += 1
If $aStep[$i] > $aWait[$i] Then
$aStep[$i] = 1
If $i <= 3 Then
$aWait[$i] = Random(140, 500, 1)
Else
$aWait[$i] = Random(400, 1000, 1)
EndIf
$aPos[$i][0] = Random(-300, 300, 1)
$aPos[$i][1] = Random(-200, 100, 1)
$fR = Random(0, 1)
$fG = Random(0, 1)
$fB = Random(0, 1)
Switch Random(0, 2, 1)
Case 0
$fR = 1
Case 1
$fG = 1
Case Else
$fB = 1
EndSwitch
DllStructSetData($tColorMX, 1, $fR, 1)
DllStructSetData($tColorMX, 2, $fG, 2)
DllStructSetData($tColorMX, 3, $fB, 3)
DllCall($ghGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $aAttrib[$i], "int", 1, "int", 1, "ptr", DllStructGetPtr($tColorMX), "ptr", 0, "int", 0)
EndIf
Next
_GDIPlus_GraphicsDrawImage($hGfxBuffer, $hBmpBG, 0, 0)
[/autoit] [autoit][/autoit] [autoit]If $aStep[1] <= 128 Then DllCall($ghGDIPDll, "int", "GdipDrawImageRectRectI", "hwnd", $hGfxBuffer, "hwnd", $aFW_B[$aStep[1]], "int", $aPos[1][0], "int", $aPos[1][1], "int", $iWidth, "int", $iHeight, "int", 0, "int", 0, "int", $iWidth, "int", $iHeight, "int", 2, "ptr", $aAttrib[1], "int", 0, "int", 0)
If $aStep[2] <= 128 Then DllCall($ghGDIPDll, "int", "GdipDrawImageRectRectI", "hwnd", $hGfxBuffer, "hwnd", $aFW_M[$aStep[2]], "int", $aPos[2][0], "int", $aPos[2][1], "int", $iWidth, "int", $iHeight, "int", 0, "int", 0, "int", $iWidth, "int", $iHeight, "int", 2, "ptr", $aAttrib[2], "int", 0, "int", 0)
If $aStep[3] <= 128 Then DllCall($ghGDIPDll, "int", "GdipDrawImageRectRectI", "hwnd", $hGfxBuffer, "hwnd", $aFW_S[$aStep[3]], "int", $aPos[3][0], "int", $aPos[3][1], "int", $iWidth, "int", $iHeight, "int", 0, "int", 0, "int", $iWidth, "int", $iHeight, "int", 2, "ptr", $aAttrib[3], "int", 0, "int", 0)
If $aStep[4] <= 128 Then DllCall($ghGDIPDll, "int", "GdipDrawImageRectRectI", "hwnd", $hGfxBuffer, "hwnd", $aFW_B[$aStep[4]], "int", $aPos[4][0], "int", $aPos[4][1], "int", $iWidth, "int", $iHeight, "int", 0, "int", 0, "int", $iWidth, "int", $iHeight, "int", 2, "ptr", $aAttrib[4], "int", 0, "int", 0)
If $aStep[5] <= 128 Then DllCall($ghGDIPDll, "int", "GdipDrawImageRectRectI", "hwnd", $hGfxBuffer, "hwnd", $aFW_M[$aStep[5]], "int", $aPos[5][0], "int", $aPos[5][1], "int", $iWidth, "int", $iHeight, "int", 0, "int", 0, "int", $iWidth, "int", $iHeight, "int", 2, "ptr", $aAttrib[5], "int", 0, "int", 0)
If $aStep[6] <= 128 Then DllCall($ghGDIPDll, "int", "GdipDrawImageRectRectI", "hwnd", $hGfxBuffer, "hwnd", $aFW_S[$aStep[6]], "int", $aPos[6][0], "int", $aPos[6][1], "int", $iWidth, "int", $iHeight, "int", 0, "int", 0, "int", $iWidth, "int", $iHeight, "int", 2, "ptr", $aAttrib[6], "int", 0, "int", 0)
_WinAPI_BitBlt($hDC, 0, 0, $iWidth, $iHeight, $hCDC, 0, 0, 0x00CC0020)
EndFunc ;==>_Draw
Func WM_PAINT($hWnd, $uMsgm, $wParam, $lParam)
_WinAPI_BitBlt($hDC, 0, 0, $iWidth, $iHeight, $hCDC, 0, 0, 0x00CC0020)
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_PAINT
Func _Exit()
For $i = 1 To 6
DllCall($ghGDIPDll, "int", "GdipDisposeImageAttributes", "ptr", $aAttrib[$i])
Next
_FireWork_Dispose($aFW_B)
_FireWork_Dispose($aFW_M)
_FireWork_Dispose($aFW_S)
_GDIPlus_BitmapDispose($hBmpBG)
_GDIPlus_GraphicsDispose($hGfxBuffer)
_WinAPI_SelectObject($hCDC, $hOBJ)
_WinAPI_DeleteObject($hBMP)
_WinAPI_DeleteDC($hCDC)
_WinAPI_ReleaseDC($hGui, $hDC)
_GDIPlus_Shutdown()
Exit
EndFunc ;==>_Exit
Läuft zwar nicht 100% flüssig, aber ich hoffe, es gefällt euch trotzdem...
autoit.de/wcf/attachment/16922/
Viel Spaß beim Ausprobieren!
E