Visualizer

  • Ich habe mal einen Visualizer (ich hoffe das nennt man so) mit GDIPlus geschrieben. Über Rückmeldungen würde ich mich freuen!
    To do: Mehr Farbwechselfunktionen und Visualationsarten

    Bedienung:
    Mit Escape schließen und mit Enter zwischen den Visualationen wechseln.

    Ihr benötigt 2 BassDlls und die dazugehörigen UDFs (alles im Anhang).

    Neu: Version 2.1 mit 8 Visualisierungen

    Ideen für neue Visualationen sind immer und herzlich willkommen!

    Visualizer Version 2.1
    [autoit]


    ;Thanks to BrettF, ProgAndy, eukalyptus from autoitscript.com for the Bass.dlls and their support!
    ;Thanks to Jurax, Ahnungslos and UEZ from AutoIt.de for their support, too!
    ;scripted by xp_fan
    #include <Bass.au3>
    #include <BassConstants.au3>
    #include <BassTags.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GDIplus.au3>
    #include <WinAPI.au3>
    #include <Misc.au3>

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

    _BASS_STARTUP(@ScriptDir & '\BASS.dll')
    _Bass_Tags_Startup('BassTags.dll')
    _BASS_Init(0, -1, 44100, 0, '')

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

    If @error Then
    MsgBox(0, 'Error', 'Sound konnte nicht Initialisiert werden!')
    Exit
    EndIf
    Global $file = FileOpenDialog('Bitte wählen Sie eine Sounddatei aus!', '', 'MP3 Datei (*.mp3)')
    If @error Then
    Exit
    EndIf
    Global $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    Global $ID3Album = _Bass_Tags_Read($MusicHandle, '%IFV1(%ALBM,%IUPC(%ALBM))')
    If @error Then
    Exit
    EndIf

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

    Global $ID3Title = _Bass_Tags_Read($MusicHandle, '%IFV1(%TRCK,%TRCK. )%IFV2(%ARTI,%ICAP(%ARTI), Nichts) - %IFV2(%TITL,%ICAP(%TITL) , Nichts )')

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

    If @error Then
    Exit
    EndIf

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

    Global $fftstruct = DllStructCreate('float[128]')
    _BASS_ChannelPlay($MusicHandle, 0)

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

    _GDIPlus_Startup()

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

    Global $sleep = 30
    Global $Koordinatenx[29]
    Global $Koordinateny[29]
    Global $counterR = 150
    Global $counterG = 0
    Global $counterB = 0
    Global $Visualation = Random(1, 8, 1)
    Global $HexFarbe1
    Global $HexFarbe2
    Global $full1 = 0
    Global $full2 = 0
    Global $full3 = 0
    Global $full4 = 0
    Global $full5 = 0
    Global $hochz = 0
    Global $distance = 7
    Global $colorchange = 100
    Global $brushchange = 50
    Global $Alpha1 = 21
    Global $Alpha2 = 255
    Global $Colors1[12] = [0xFFFF0000, 0xFF00FF00, 0xFF0000FF, 0xFFFFFF00, 0xFFFFA500, 0xFF8B0000, 0xFFA146FF, 0xFFCEA66B, 0xFF0033EE, 0xFFFFD700, 0xFF999999, 0xFFEEEEEE]
    Global $dll = DllOpen('user32.dll')
    Global $hwnd = GUICreate('GDIPlus Visualizer Version 2.1', @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
    Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hwnd)
    Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics(700, 700, $hGraphic)
    Global $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    Global $Pen1 = _GDIPlus_PenCreate(0xFF0000FF, 20, 2)
    Global $Pen2 = _GDIPlus_PenCreate(0x330000FF, 20, 2)
    Global $hBrush1 = _GDIPlus_BrushCreateSolid(0x00FFFFFF)
    Global $hBrush2 = _GDIPlus_BrushCreateSolid(0x00FFFFFF)
    Global $hBrush3 = _GDIPlus_BrushCreateSolid(0x00FFFFFF)
    Global $hBrush4 = _GDIPlus_BrushCreateSolid(0x00FFFFFF)
    Global $hBrush5 = _GDIPlus_BrushCreateLinear(0, 200, 0, 400, 0x00FFFFFF, 0x00FFFFFF)
    Global $hBrush6 = _GDIPlus_BrushCreateSolid(0xFFFF0000)
    Global $hFormat = _GDIPlus_StringFormatCreate()
    Global $hFamily = _GDIPlus_FontFamilyCreate('Arial')
    Global $hFont = _GDIPlus_FontCreate($hFamily, 20, 1, 2)
    Global $tLayout1 = _GDIPlus_RectFCreate(100, 70, 500, 35)
    Global $tLayout2 = _GDIPlus_RectFCreate(100, 105, 500, 35)
    _GDIPlus_GraphicsClear($hContext)
    For $i = 1 To 28 Step 1
    $Koordinatenx[$i] = Random(50, @DesktopWidth - 555, 1)
    $Koordinateny[$i] = Random(200, @DesktopHeight - 333, 1)
    Next
    WinSetOnTop($hwnd, '', 1)
    GUISetBkColor(0x000000)
    GUISetCursor(16)
    GUISetState(@SW_SHOW)
    _Farbverlauf()
    HotKeySet('{ENTER}', '_Count')
    HotKeySet('{ESC}', 'OnAutoItExit')

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

    AdlibRegister('_BrushColor', $brushchange)
    AdlibRegister('_Color', $colorchange)
    AdlibRegister('_Farbverlauf', 5000)

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

    Global $song_length = _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE)

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

    While 1
    Select
    Case $song_length = _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE)
    Sleep(3000)
    OnAutoItExit()
    Case $Visualation = 1
    _Tower()
    Case $Visualation = 2
    _TowerSmall()
    Case $Visualation = 3
    _Balken()
    Case $Visualation = 4
    _Speech()
    Case $Visualation = 5
    _Flummies()
    Case $Visualation = 6
    _FillCircles()
    Case $Visualation = 7
    _TowerFarbverlauf()
    Case $Visualation = 8
    _ColorByHeight()
    EndSelect
    Sleep($sleep)
    WEnd

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

    Func OnAutoItExit()
    DllClose($dll)
    _BASS_Stop()
    _BASS_Free()
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_PenDispose($Pen1)
    _GDIPlus_PenDispose($Pen2)
    _GDIPlus_BrushDispose($hBrush1)
    _GDIPlus_BrushDispose($hBrush2)
    _GDIPlus_BrushDispose($hBrush3)
    _GDIPlus_BrushDispose($hBrush4)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_GraphicsDispose($hContext)
    _WinAPI_DeleteObject($hBitmap)
    _GDIPlus_Shutdown()
    AdlibUnRegister()
    Exit
    EndFunc ;==>OnAutoItExit

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

    Func _Tower()
    _GDIPlus_GraphicsClear($hContext, 0xFF000000)
    _GDIPlus_GraphicsDrawStringEx($hContext, $ID3Album, $hFont, $tLayout1, $hFormat, $hBrush1)
    _GDIPlus_GraphicsDrawStringEx($hContext, $ID3Title, $hFont, $tLayout2, $hFormat, $hBrush2)
    _GDIPlus_PenSetWidth($Pen1, 20)
    _GDIPlus_PenSetWidth($Pen2, 20)
    $level = 300
    _BASS_ChannelGetData($MusicHandle, DllStructGetPtr($fftstruct), $BASS_DATA_FFT256)
    For $i = 1 To 28 Step 1
    If $i > 5 Then $level = 500
    _GDIPlus_GraphicsDrawLine($hContext, 20 * $i, 400, 20 * $i, 400 - DllStructGetData($fftstruct, 1, $i) * $level, $Pen1)
    _GDIPlus_GraphicsDrawLine($hContext, 20 * $i, 400 + $distance, 20 * $i, (400 + $distance) + DllStructGetData($fftstruct, 1, $i) * $level, $Pen2)
    _GDIPlus_GraphicsSetSmoothingMode($hContext, 2)
    Next
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 250, 100, @DesktopWidth - 300, @DesktopHeight)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2)
    EndFunc ;==>_Tower

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

    Func _TowerSmall()
    _GDIPlus_GraphicsClear($hContext, 0xFF000000)
    _GDIPlus_GraphicsDrawStringEx($hContext, $ID3Album, $hFont, $tLayout1, $hFormat, $hBrush1)
    _GDIPlus_GraphicsDrawStringEx($hContext, $ID3Title, $hFont, $tLayout2, $hFormat, $hBrush2)
    _GDIPlus_PenSetWidth($Pen1, 3)
    _GDIPlus_PenSetWidth($Pen2, 3)
    $level = 300
    _BASS_ChannelGetData($MusicHandle, DllStructGetPtr($fftstruct), $BASS_DATA_FFT256)
    For $i = 1 To 28 Step 1
    If $i > 5 Then $level = 500
    _GDIPlus_GraphicsDrawLine($hContext, 20 * $i - 10, 400, 20 * $i - 10, 400 - DllStructGetData($fftstruct, 1, $i) * $level, $Pen1)
    _GDIPlus_GraphicsDrawLine($hContext, 20 * $i - 10, 400 + $distance, 20 * $i - 10, (400 + $distance) + DllStructGetData($fftstruct, 1, $i) * $level, $Pen2)
    _GDIPlus_GraphicsSetSmoothingMode($hContext, 2)
    Next
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 250, 100, @DesktopWidth - 300, @DesktopHeight)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2)
    EndFunc ;==>_TowerSmall

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

    Func _Balken()
    _GDIPlus_GraphicsClear($hContext, 0xFF000000)
    _GDIPlus_GraphicsDrawStringEx($hContext, $ID3Album, $hFont, $tLayout1, $hFormat, $hBrush1)
    _GDIPlus_GraphicsDrawStringEx($hContext, $ID3Title, $hFont, $tLayout2, $hFormat, $hBrush2)
    _GDIPlus_PenSetWidth($Pen1, 14)
    _GDIPlus_PenSetWidth($Pen2, 14)
    $level = 500
    _BASS_ChannelGetData($MusicHandle, DllStructGetPtr($fftstruct), $BASS_DATA_FFT256)
    For $i = 1 To 28 Step 1
    If $i > 5 Then $level = 700
    _GDIPlus_GraphicsDrawLine($hContext, 70, 15 * $i + 150, 70 + DllStructGetData($fftstruct, 1, $i) * $level, 15 * $i + 150, $Pen1)
    _GDIPlus_GraphicsSetSmoothingMode($hContext, 2)
    Next
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 250, 100, @DesktopWidth - 300, @DesktopHeight)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2)
    EndFunc ;==>_Balken

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

    Func _Speech()
    _GDIPlus_GraphicsClear($hContext, 0xFF000000)
    _GDIPlus_GraphicsDrawStringEx($hContext, $ID3Album, $hFont, $tLayout1, $hFormat, $hBrush1)
    _GDIPlus_GraphicsDrawStringEx($hContext, $ID3Title, $hFont, $tLayout2, $hFormat, $hBrush2)
    _GDIPlus_PenSetWidth($Pen1, 2)
    _GDIPlus_PenSetWidth($Pen2, 2)
    $level = 300
    _BASS_ChannelGetData($MusicHandle, DllStructGetPtr($fftstruct), $BASS_DATA_FFT256)
    For $i = 1 To 28 Step 1
    If $i > 5 Then $level = 500
    _GDIPlus_GraphicsDrawLine($hContext, 20 * $i, 400, (20 * $i) + 10, 400 - DllStructGetData($fftstruct, 1, $i) * $level, $Pen1)
    _GDIPlus_GraphicsDrawLine($hContext, (20 * $i) + 10, 400 - DllStructGetData($fftstruct, 1, $i) * $level, (20 * $i) + 10, 400 + DllStructGetData($fftstruct, 1, $i) * $level, $Pen1)
    _GDIPlus_GraphicsDrawLine($hContext, (20 * $i) + 10, 400 + DllStructGetData($fftstruct, 1, $i) * $level, (20 * $i) + 20, 400, $Pen1)
    _GDIPlus_GraphicsSetSmoothingMode($hContext, 2)
    Next
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 250, 100, @DesktopWidth - 300, @DesktopHeight)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2)
    EndFunc ;==>_Speech

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

    Func _Flummies()
    _GDIPlus_GraphicsClear($hContext, 0xFF000000)
    _GDIPlus_GraphicsDrawStringEx($hContext, $ID3Album, $hFont, $tLayout1, $hFormat, $hBrush1)
    _GDIPlus_GraphicsDrawStringEx($hContext, $ID3Title, $hFont, $tLayout2, $hFormat, $hBrush2)
    $level = 300
    _BASS_ChannelGetData($MusicHandle, DllStructGetPtr($fftstruct), $BASS_DATA_FFT256)
    For $i = 1 To 28 Step 1
    If $i > 5 Then $level = 500
    _GDIPlus_GraphicsFillEllipse($hContext, 20 * $i, 400 - DllStructGetData($fftstruct, 1, $i) * $level, 15, 15, $hBrush3)
    _GDIPlus_GraphicsFillEllipse($hContext, 20 * $i, 400 + DllStructGetData($fftstruct, 1, $i) * $level, 15, 15, $hBrush4)
    _GDIPlus_GraphicsSetSmoothingMode($hContext, 2)
    Next
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 250, 100, @DesktopWidth - 300, @DesktopHeight)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2)
    EndFunc ;==>_Flummies

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

    Func _FillCircles()
    _GDIPlus_GraphicsClear($hContext, 0xFF000000)
    _GDIPlus_GraphicsDrawStringEx($hContext, $ID3Album, $hFont, $tLayout1, $hFormat, $hBrush1)
    _GDIPlus_GraphicsDrawStringEx($hContext, $ID3Title, $hFont, $tLayout2, $hFormat, $hBrush2)
    _BASS_ChannelGetData($MusicHandle, DllStructGetPtr($fftstruct), $BASS_DATA_FFT256)
    $level = 110
    For $i = 1 To 28 Step 1
    If $i > 5 Then $level = 400
    _GDIPlus_GraphicsFillEllipse($hContext, $Koordinatenx[$i] - DllStructGetData($fftstruct, 1, $i) * $level / 2, $Koordinateny[$i] - DllStructGetData($fftstruct, 1, $i) * $level / 2, DllStructGetData($fftstruct, 1, $i) * $level, DllStructGetData($fftstruct, 1, $i) * $level, $hBrush3)
    _GDIPlus_GraphicsSetSmoothingMode($hContext, 2)
    Next
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 250, 100, @DesktopWidth - 300, @DesktopHeight)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2)
    EndFunc ;==>_FillCircles

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

    Func _TowerFarbverlauf()
    _GDIPlus_GraphicsClear($hContext, 0xFF000000)
    _GDIPlus_GraphicsDrawStringEx($hContext, $ID3Album, $hFont, $tLayout1, $hFormat, $hBrush1)
    _GDIPlus_GraphicsDrawStringEx($hContext, $ID3Title, $hFont, $tLayout2, $hFormat, $hBrush2)
    $level = 100
    _BASS_ChannelGetData($MusicHandle, DllStructGetPtr($fftstruct), $BASS_DATA_FFT256)
    For $i = 1 To 28 Step 1
    If $i > 5 Then $level = 500
    Global $hBrush5 = _GDIPlus_BrushCreateLinear(0, 400 - DllStructGetData($fftstruct, 1, $i) * $level - 2, 0, 400, $HexFarbe1, $HexFarbe2)
    _GDIPlus_GraphicsFillRect($hContext, 20 * $i, 400 - DllStructGetData($fftstruct, 1, $i) * $level, 20, DllStructGetData($fftstruct, 1, $i) * $level, $hBrush5)
    _GDIPlus_GraphicsSetSmoothingMode($hContext, 2)
    Next
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 250, 100, @DesktopWidth - 300, @DesktopHeight)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2)
    EndFunc ;==>_TowerFarbverlauf

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

    Func _Farbverlauf()
    Do
    Global $HexFarbe1 = $Colors1[Random(0, 11, 1)]
    Global $HexFarbe2 = $Colors1[Random(0, 11, 1)]
    Sleep(1)
    Until $HexFarbe1 <> $HexFarbe2
    EndFunc ;==>_Farbverlauf

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

    Func _Color()
    Select
    Case $counterB = 0 And $counterG = 0 And $full3 = 0 And $full5 = 0; Start
    $counterR += 1
    If $counterR = 255 Then $counterG = 1
    Case $counterR = 255 And $full4 = 0 And $full5 = 0; Wenn rot voll, dann Übergang nach gelb
    $counterG += 1
    If $counterG = 255 Then $counterR -= 1
    Case $counterG = 255 And $full3 = 0 And $full4 = 0 And $full5 = 0; Wenn grün voll, dann Übergang nach grün
    $counterR -= 1
    If $counterR = 0 Then
    $counterB = 1
    $counterG = 254
    EndIf
    Case $counterG = 254 And $counterB >= 1 And $full2 = 0 And $full4 = 0 And $full5 = 0; Wenn rot leer, dann blau erhöhen
    $counterB += 1
    If $counterB = 255 And $counterG = 254 And $full3 = 0 Then
    $counterG = 253
    $full2 = 1
    EndIf
    Case $counterB = 255 And $full3 = 0 And $full4 = 0 And $full5 = 0; Wenn blau voll, grün vermindern
    $counterG -= 1
    If $counterG = 0 Then $full3 = 1
    Case $full3 = 1 And $full4 = 0 And $full5 = 0; Wenn Blau voll und grün leer, rot erhöhen
    $counterR += 1
    If $counterR = 255 Then $full4 = 1
    Case $full4 = 1 And $full5 = 0; Wenn rot voll, grün erhöhen, um weiß zu erhalten
    $counterG += 1
    If $counterG = 255 Then $full5 = 1
    Case $full5 = 1
    $counterR -= 1
    $counterG -= 1
    $counterB -= 1
    If $counterG = 0 Then
    $counterG = 0
    $counterB = 0
    $counterR = 0
    $full1 = 0
    $full2 = 0
    $full3 = 0
    $full4 = 0
    $full5 = 0
    EndIf
    EndSelect
    Local $Farbe = Hex($counterR, 2) & Hex($counterG, 2) & Hex($counterB, 2)
    _GDIPlus_PenSetColor($Pen1, '0xDD' & $Farbe)
    _GDIPlus_PenSetColor($Pen2, '0x33' & $Farbe)
    _GDIPlus_BrushSetSolidColor($hBrush3, '0xDD' & $Farbe)
    _GDIPlus_BrushSetSolidColor($hBrush4, '0x33' & $Farbe)
    EndFunc ;==>_Color

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

    Func _BrushColor()
    If $Alpha1 = 21 Then
    $hochz = 1
    $Alpha1 += 1
    $Alpha2 -= 1
    EndIf

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

    If $Alpha1 = 255 Then
    $hochz = 0
    $Alpha1 -= 1
    $Alpha2 += 1
    EndIf

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

    If $hochz = 1 Then
    $Alpha1 += 1
    $Alpha2 -= 1
    Else
    $Alpha1 -= 1
    $Alpha2 += 1
    EndIf
    _GDIPlus_BrushSetSolidColor($hBrush1, '0x' & Hex($Alpha1, 2) & 'FFFFFF')
    _GDIPlus_BrushSetSolidColor($hBrush2, '0x' & Hex($Alpha2, 2) & 'FFFFFF')
    EndFunc ;==>_BrushColor

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

    Func _Count()
    $Visualation += 1
    If $Visualation >= 9 Then $Visualation = 1
    EndFunc ;==>_Count

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

    Func _GDIPlus_BrushCreateLinear($iX1, $iY1, $iX2, $iY2, $iARGB1 = 0xFF000000, $iARGB2 = 0xFFFFFFFF)
    Local $aResult, $start, $end, $sPoint, $ePoint

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

    $start = DllStructCreate("int X;int Y")
    DllStructSetData($start, "X", $iX1)
    DllStructSetData($start, "Y", $iY1)
    $sPoint = DllStructGetPtr($start)

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

    $end = DllStructCreate("int X;int Y")
    DllStructSetData($end, "X", $iX2)
    DllStructSetData($end, "Y", $iY2)
    $ePoint = DllStructGetPtr($end)

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

    $aResult = DllCall($ghGDIPDll, "int", "GdipCreateLineBrushI", "ptr", $sPoint, "ptr", $ePoint, "int", $iARGB1, "int", $iARGB2, "int", 0, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)

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

    Return SetError(0, $aResult[0], $aResult[6])
    EndFunc ;==>_GDIPlus_BrushCreateLinear

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

    Func _ColorByHeight()
    _GDIPlus_GraphicsClear($hContext, 0xFF000000)
    _GDIPlus_GraphicsDrawStringEx($hContext, $ID3Album, $hFont, $tLayout1, $hFormat, $hBrush1)
    _GDIPlus_GraphicsDrawStringEx($hContext, $ID3Title, $hFont, $tLayout2, $hFormat, $hBrush2)
    $level = 100
    _BASS_ChannelGetData($MusicHandle, DllStructGetPtr($fftstruct), $BASS_DATA_FFT256)
    For $i = 1 To 28 Step 1
    If $i > 5 Then $level = 500
    $val = DllStructGetData($fftstruct, 1, $i)
    $col = $val * 3.55 * $level
    If $col > 255 Then $col = 255
    _GDIPlus_BrushSetSolidColor($hBrush6, BitOR(0xFF000000, BitShift(255 - $col, -8), BitShift($col, -16)))
    _GDIPlus_GraphicsFillRect($hContext, 20 * $i, 400 - $val * $level, 20, $val * $level, $hBrush6)
    _GDIPlus_GraphicsSetSmoothingMode($hContext, 2)
    Next
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 250, 100, @DesktopWidth - 300, @DesktopHeight)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2)
    EndFunc ;==>_ColorByHeight

    [/autoit] [autoit][/autoit] [autoit][/autoit]
  • Nettes Script.
    Finds wirklich sehr nett gelungen.
    Jetzt versuch doch ma so eine Visualizierung wie im WMP :D
    MfG. PrideRage

    Meine Projekte:
    ClipBoard Manager (beendet)
    Gutes ClipBoard Verwaltungs Programm mit nützlichen Funktionen.

    HTML Creator (beendet)
    Nützliches Tool um schnell ein eigenes HTML Dokument zu erstellen.

  • gut gelungen sag cih nur

    was du verändern köntest wäre, das wenn man auf abbrechen klickt nicht diese error meldung kommen sollte ;)

    aber sonst alles 1A :thumbup:

  • Danke, für das viele Lob!

    was du verändern köntest wäre, das wenn man auf abbrechen klickt nicht diese error meldung kommen sollte ;)

    Schon passiert!


  • -Farbe nach Musik richten :D


    Eher schon nach der Lautstärke ;) Die Färbung der einzelnen Balken je nach ihrer Länge sähe meiner Meinung nach ganz gut aus. Je länger, desto roter oder so.


    -evtl. Webradios abspielen können wenn das nicht sogar mit der bass geht


    Die Bass.dll kann das schon, Erstelle doch selbst ein Radio und baue da dann die Visualisierungen ein ;)

  • @progandy:
    Ich hab's mal mit der Farbverlaufsfunktion von Ahnungslos probiert, aber irgendwie schaff' ich's nicht, dass er in jede Säule einen Farverlauf macht. Was mache ich falsch?

    Fehlerhafter Teil
    [autoit]

    Func Update()
    _GDIPlus_GraphicsClear($hContext, 0xFF000000)
    _GDIPlus_GraphicsDrawStringEx($hContext, $ID3Album, $hFont, $tLayout1, $hFormat, $hBrush1)
    _GDIPlus_GraphicsDrawStringEx($hContext, $ID3Title, $hFont, $tLayout2, $hFormat, $hBrush2)
    $level = 100
    _BASS_ChannelGetData($MusicHandle, DllStructGetPtr($fftstruct), $BASS_DATA_FFT256)
    For $i = 1 To 28 Step 1
    If $i > 5 Then $level = 500
    ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Global $hBrush5 = _GDIPlus_BrushCreateLinear(0, 20 * $i, 400, 20 * $i, 0xFFFF0000, 0xFF00FF00)
    ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    _GDIPlus_GraphicsFillRect($hContext, 20 * $i, 400 - DllStructGetData($fftstruct, 1, $i) * $level, 20, DllStructGetData($fftstruct, 1, $i) * $level, $hBrush5)
    ;_GDIPlus_GraphicsDrawLine($hContext, 20 * $i, 400, 20 * $i, 400 - DllStructGetData($fftstruct, 1, $i) * $level, $Pen1)
    _GDIPlus_GraphicsSetSmoothingMode($hContext, 2)
    Next
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 250, 100, @DesktopWidth - 300, @DesktopHeight)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2)
    EndFunc ;==>Update

    [/autoit]
    Script
    [autoit]

    ;Thanks to BrettF, ProgAndy, eukalyptus from autoitscript.com for the Bass.dlls, Jurax, Ahnungslos and UEZ from AutoIt.de!
    ;scripted by xp_fan
    #include <Bass.au3>
    #include <BassConstants.au3>
    #include <BassTags.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GDIplus.au3>
    #include <WinAPI.au3>

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

    HotKeySet('{ESC}', 'OnAutoItExit')

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

    _BASS_STARTUP(@ScriptDir & '\BASS.dll')
    _Bass_Tags_Startup('BassTags.dll')
    _BASS_Init(0, -1, 44100, 0, '')

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

    If @error Then
    MsgBox(0, 'Error', 'Sound konnte nicht Initialisiert werden!')
    Exit
    EndIf
    Global $file = FileOpenDialog('Bitte wählen Sie eine Sounddatei aus!', '', 'MP3 Datei (*.mp3)')
    If @error Then
    Exit
    EndIf
    Global $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    Global $ID3Album = _Bass_Tags_Read($MusicHandle, '%IFV1(%ALBM,%IUPC(%ALBM))')
    If @error Then
    Exit
    EndIf

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

    Global $ID3Title = _Bass_Tags_Read($MusicHandle, '%IFV1(%TRCK,%TRCK. )%IFV2(%ARTI,%ICAP(%ARTI), Nichts) - %IFV2(%TITL,%ICAP(%TITL) , Nichts )')

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

    If @error Then
    Exit
    EndIf

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

    Global $fftstruct = DllStructCreate('float[128]')
    _BASS_ChannelPlay($MusicHandle, 0)

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

    Global $counterR = 150
    Global $counterG = 0
    Global $counterB = 0
    Global $full1 = 0
    Global $full2 = 0
    Global $full3 = 0
    Global $full4 = 0
    Global $full5 = 0
    Global $hochz = 0
    Global $distance = 7
    Global $sleep = 70
    Global $colorchange = 100
    Global $brushchange = 50
    Global $Alpha1 = 21
    Global $Alpha2 = 255

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

    Global $hwnd = GUICreate('GDIPlus Visualizer', @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
    WinSetOnTop($hwnd, '', 1)
    GUISetBkColor(0x000000)
    GUISetCursor(16)

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

    GUISetState(@SW_SHOW)

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

    _GDIPlus_Startup()
    Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hwnd)
    Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics(700, 700, $hGraphic)
    Global $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    Global $Pen1 = _GDIPlus_PenCreate(0xFF0000FF, 20, 2)
    Global $Pen2 = _GDIPlus_PenCreate(0x330000FF, 20, 2)
    Global $hBrush1 = _GDIPlus_BrushCreateSolid(0x00FFFFFF)
    Global $hBrush2 = _GDIPlus_BrushCreateSolid(0x00FFFFFF)
    Global $hBrush6 = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    Global $hBrush5 = _GDIPlus_BrushCreateLinear(0, 20, 400, 20, 0xFFFF0000, 0xFF00FF00)
    Global $hFormat = _GDIPlus_StringFormatCreate()
    Global $hFamily = _GDIPlus_FontFamilyCreate('Arial')
    Global $hFont = _GDIPlus_FontCreate($hFamily, 20, 1, 2)
    Global $tLayout1 = _GDIPlus_RectFCreate(100, 70, 500, 35)
    Global $tLayout2 = _GDIPlus_RectFCreate(100, 105, 500, 35)
    _GDIPlus_GraphicsClear($hContext)

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

    AdlibRegister('_BrushColor', $brushchange)
    ;AdlibRegister('_Color', $colorchange)
    AdlibRegister('Update', $sleep)

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

    $song_length = _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE)
    While 1
    Sleep(20)
    If $song_length = _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE) Then
    Sleep(3000)
    OnAutoItExit()
    EndIf
    WEnd

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

    Func OnAutoItExit()
    _BASS_Stop()
    _BASS_Free()
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_PenDispose($Pen1)
    _GDIPlus_PenDispose($Pen2)
    _GDIPlus_BrushDispose($hBrush1)
    _GDIPlus_BrushDispose($hBrush2)
    _GDIPlus_BrushDispose($hBrush5)
    _GDIPlus_BrushDispose($hBrush6)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_GraphicsDispose($hContext)
    _WinAPI_DeleteObject($hBitmap)
    _GDIPlus_Shutdown()
    AdlibUnRegister()
    Exit
    EndFunc ;==>OnAutoItExit

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

    Func Update()
    _GDIPlus_GraphicsClear($hContext, 0xFF000000)
    _GDIPlus_GraphicsDrawStringEx($hContext, $ID3Album, $hFont, $tLayout1, $hFormat, $hBrush1)
    _GDIPlus_GraphicsDrawStringEx($hContext, $ID3Title, $hFont, $tLayout2, $hFormat, $hBrush2)
    $level = 100
    _BASS_ChannelGetData($MusicHandle, DllStructGetPtr($fftstruct), $BASS_DATA_FFT256)
    For $i = 1 To 28 Step 1
    If $i > 5 Then $level = 500
    ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Global $hBrush5 = _GDIPlus_BrushCreateLinear(0, 20 * $i, 400, 20 * $i, 0xFFFF0000, 0xFF00FF00)
    ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    _GDIPlus_GraphicsFillRect($hContext, 20 * $i, 400 - DllStructGetData($fftstruct, 1, $i) * $level, 20, DllStructGetData($fftstruct, 1, $i) * $level, $hBrush5)
    ;_GDIPlus_GraphicsDrawLine($hContext, 20 * $i, 400, 20 * $i, 400 - DllStructGetData($fftstruct, 1, $i) * $level, $Pen1)
    _GDIPlus_GraphicsSetSmoothingMode($hContext, 2)
    Next
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 250, 100, @DesktopWidth - 300, @DesktopHeight)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2)
    EndFunc ;==>Update

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

    Func _Color()
    Select
    Case $counterB = 0 And $counterG = 0 And $full3 = 0 And $full5 = 0; Start
    $counterR += 1
    If $counterR = 255 Then $counterG = 1
    Case $counterR = 255 And $full4 = 0 And $full5 = 0; Wenn rot voll, dann Übergang nach gelb
    $counterG += 1
    If $counterG = 255 Then $counterR -= 1
    Case $counterG = 255 And $full3 = 0 And $full4 = 0 And $full5 = 0; Wenn grün voll, dann Übergang nach grün
    $counterR -= 1
    If $counterR = 0 Then
    $counterB = 1
    $counterG = 254
    EndIf
    Case $counterG = 254 And $counterB >= 1 And $full2 = 0 And $full4 = 0 And $full5 = 0; Wenn rot leer, dann blau erhöhen
    $counterB += 1
    If $counterB = 255 And $counterG = 254 And $full3 = 0 Then
    $counterG = 253
    $full2 = 1
    EndIf
    Case $counterB = 255 And $full3 = 0 And $full4 = 0 And $full5 = 0; Wenn blau voll, grün vermindern
    $counterG -= 1
    If $counterG = 0 Then $full3 = 1
    Case $full3 = 1 And $full4 = 0 And $full5 = 0; Wenn Blau voll und grün leer, rot erhöhen
    $counterR += 1
    If $counterR = 255 Then $full4 = 1
    Case $full4 = 1 And $full5 = 0; Wenn rot voll, grün erhöhen, um weiß zu erhalten
    $counterG += 1
    If $counterG = 255 Then $full5 = 1
    Case $full5 = 1
    $counterR -= 1
    $counterG -= 1
    $counterB -= 1
    If $counterG = 0 Then
    $counterG = 0
    $counterB = 0
    $counterR = 0
    $full1 = 0
    $full2 = 0
    $full3 = 0
    $full4 = 0
    $full5 = 0
    EndIf
    EndSelect
    Local $Farbe = Hex($counterR, 2) & Hex($counterG, 2) & Hex($counterB, 2)
    _GDIPlus_PenSetColor($Pen1, '0xDD' & $Farbe)
    _GDIPlus_PenSetColor($Pen2, '0x33' & $Farbe)
    EndFunc ;==>_Color

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

    Func _BrushColor()
    If $Alpha1 = 21 Then
    $hochz = 1
    $Alpha1 += 1
    $Alpha2 -= 1
    EndIf

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

    If $Alpha1 = 255 Then
    $hochz = 0
    $Alpha1 -= 1
    $Alpha2 += 1
    EndIf

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

    If $hochz = 1 Then
    $Alpha1 += 1
    $Alpha2 -= 1
    Else
    $Alpha1 -= 1
    $Alpha2 += 1
    EndIf
    _GDIPlus_BrushSetSolidColor($hBrush1, '0x' & Hex($Alpha1, 2) & 'FFFFFF')
    _GDIPlus_BrushSetSolidColor($hBrush2, '0x' & Hex($Alpha2, 2) & 'FFFFFF')
    EndFunc ;==>_BrushColor

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

    Func _GDIPlus_BrushCreateLinear($iX1, $iY1, $iX2, $iY2, $iARGB1 = 0xFF000000, $iARGB2 = 0xFFFFFFFF)
    Local $aResult, $start, $end, $sPoint, $ePoint

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

    $start = DllStructCreate("int X;int Y")
    DllStructSetData($start,"X",$iX1)
    DllStructSetData($start,"Y",$iY1)
    $sPoint = DllStructGetPtr($start)

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

    $end = DllStructCreate("int X;int Y")
    DllStructSetData($end,"X",$iX2)
    DllStructSetData($end,"Y",$iY2)
    $ePoint = DllStructGetPtr($end)

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

    $aResult = DllCall($ghGDIPDll, "int", "GdipCreateLineBrushI", "ptr", $sPoint, "ptr", $ePoint, "int", $iARGB1, "int", $iARGB2, "int", 0, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)

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

    Return SetError(0, $aResult[0], $aResult[6])
    EndFunc ;==>_GDIPlus_BrushCreateLinear

    [/autoit]
  • Den Verlauf hab ich auch nicht ganz raus, ich meinte aber, dass die gesamte saäule ihre Farbe je nach Höhe verändert, so etwa:

    Spoiler anzeigen
    [autoit]

    ;Thanks to BrettF, ProgAndy, eukalyptus from autoitscript.com for the Bass.dlls, Jurax, Ahnungslos and UEZ from AutoIt.de!
    ;scripted by xp_fan
    #include <Bass.au3>
    #include <BassConstants.au3>
    #include <BassTags.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GDIplus.au3>
    #include <WinAPI.au3>

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

    HotKeySet('{ESC}', 'OnAutoItExit')

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

    _BASS_STARTUP(@ScriptDir & '\BASS.dll')
    _Bass_Tags_Startup('BassTags.dll')
    _BASS_Init(0, -1, 44100, 0, '')

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

    If @error Then
    MsgBox(0, 'Error', 'Sound konnte nicht Initialisiert werden!')
    Exit
    EndIf
    Global $file = FileOpenDialog('Bitte wählen Sie eine Sounddatei aus!', '', 'MP3 Datei (*.mp3)')
    If @error Then
    Exit
    EndIf
    Global $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0)
    Global $ID3Album = _Bass_Tags_Read($MusicHandle, '%IFV1(%ALBM,%IUPC(%ALBM))')
    If @error Then
    Exit
    EndIf

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

    Global $ID3Title = _Bass_Tags_Read($MusicHandle, '%IFV1(%TRCK,%TRCK. )%IFV2(%ARTI,%ICAP(%ARTI), Nichts) - %IFV2(%TITL,%ICAP(%TITL) , Nichts )')

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

    If @error Then
    Exit
    EndIf

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

    Global $fftstruct = DllStructCreate('float[128]')
    _BASS_ChannelPlay($MusicHandle, 0)

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

    Global $counterR = 150
    Global $counterG = 0
    Global $counterB = 0
    Global $full1 = 0
    Global $full2 = 0
    Global $full3 = 0
    Global $full4 = 0
    Global $full5 = 0
    Global $hochz = 0
    Global $distance = 7
    Global $sleep = 70
    Global $colorchange = 100
    Global $brushchange = 50
    Global $Alpha1 = 21
    Global $Alpha2 = 255

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

    Global $hwnd = GUICreate('GDIPlus Visualizer', @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
    WinSetOnTop($hwnd, '', 1)
    GUISetBkColor(0x000000)
    GUISetCursor(16)

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

    GUISetState(@SW_SHOW)

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

    _GDIPlus_Startup()
    Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hwnd)
    Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics(700, 700, $hGraphic)
    Global $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    Global $Pen1 = _GDIPlus_PenCreate(0xFF0000FF, 20, 2)
    Global $Pen2 = _GDIPlus_PenCreate(0x330000FF, 20, 2)
    Global $hBrush1 = _GDIPlus_BrushCreateSolid(0x00FFFFFF)
    Global $hBrush2 = _GDIPlus_BrushCreateSolid(0x00FFFFFF)
    Global $hBrush6 = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    Global $hBrush5 = _GDIPlus_BrushCreateSolid(0xFF00FF00)
    ;~ Global $hBrush5 = _GDIPlus_BrushCreateLinear(0, 400, 0, 100, 0xFFFF0000, 0xFF00FF00)
    Global $hFormat = _GDIPlus_StringFormatCreate()
    Global $hFamily = _GDIPlus_FontFamilyCreate('Arial')
    Global $hFont = _GDIPlus_FontCreate($hFamily, 20, 1, 2)
    Global $tLayout1 = _GDIPlus_RectFCreate(100, 70, 500, 35)
    Global $tLayout2 = _GDIPlus_RectFCreate(100, 105, 500, 35)
    _GDIPlus_GraphicsClear($hContext)

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

    AdlibRegister('_BrushColor', $brushchange)
    ;AdlibRegister('_Color', $colorchange)
    AdlibRegister('Update', $sleep)

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

    $song_length = _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE)
    While 1
    Sleep(20)
    If $song_length = _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE) Then
    Sleep(3000)
    OnAutoItExit()
    EndIf
    WEnd

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

    Func OnAutoItExit()
    _BASS_Stop()
    _BASS_Free()
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_PenDispose($Pen1)
    _GDIPlus_PenDispose($Pen2)
    _GDIPlus_BrushDispose($hBrush1)
    _GDIPlus_BrushDispose($hBrush2)
    _GDIPlus_BrushDispose($hBrush5)
    _GDIPlus_BrushDispose($hBrush6)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_GraphicsDispose($hContext)
    _WinAPI_DeleteObject($hBitmap)
    _GDIPlus_Shutdown()
    AdlibUnRegister()
    Exit
    EndFunc ;==>OnAutoItExit

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

    Func Update()
    _GDIPlus_GraphicsClear($hContext, 0xFF000000)
    _GDIPlus_GraphicsDrawStringEx($hContext, $ID3Album, $hFont, $tLayout1, $hFormat, $hBrush1)
    _GDIPlus_GraphicsDrawStringEx($hContext, $ID3Title, $hFont, $tLayout2, $hFormat, $hBrush2)
    $level = 100
    _BASS_ChannelGetData($MusicHandle, DllStructGetPtr($fftstruct), $BASS_DATA_FFT256)
    For $i = 1 To 28 Step 1
    If $i > 5 Then $level = 500
    $val = DllStructGetData($fftstruct, 1, $i)
    $col = $val*3.55*$level
    If $col > 255 Then $col = 255
    _GDIPlus_BrushSetSolidColor($hBrush5, BitOR(0xFF000000, BitShift(255-$col, -8), BitShift($col, -16)))
    _GDIPlus_GraphicsFillRect($hContext, 20 * $i, 400 - $val * $level, 20, $val * $level, $hBrush5)
    ;_GDIPlus_GraphicsDrawLine($hContext, 20 * $i, 400, 20 * $i, 400 - DllStructGetData($fftstruct, 1, $i) * $level, $Pen1)
    _GDIPlus_GraphicsSetSmoothingMode($hContext, 2)
    Next
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 250, 100, @DesktopWidth - 300, @DesktopHeight)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2)
    EndFunc ;==>Update

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

    Func _Color()
    Select
    Case $counterB = 0 And $counterG = 0 And $full3 = 0 And $full5 = 0; Start
    $counterR += 1
    If $counterR = 255 Then $counterG = 1
    Case $counterR = 255 And $full4 = 0 And $full5 = 0; Wenn rot voll, dann Übergang nach gelb
    $counterG += 1
    If $counterG = 255 Then $counterR -= 1
    Case $counterG = 255 And $full3 = 0 And $full4 = 0 And $full5 = 0; Wenn grün voll, dann Übergang nach grün
    $counterR -= 1
    If $counterR = 0 Then
    $counterB = 1
    $counterG = 254
    EndIf
    Case $counterG = 254 And $counterB >= 1 And $full2 = 0 And $full4 = 0 And $full5 = 0; Wenn rot leer, dann blau erhöhen
    $counterB += 1
    If $counterB = 255 And $counterG = 254 And $full3 = 0 Then
    $counterG = 253
    $full2 = 1
    EndIf
    Case $counterB = 255 And $full3 = 0 And $full4 = 0 And $full5 = 0; Wenn blau voll, grün vermindern
    $counterG -= 1
    If $counterG = 0 Then $full3 = 1
    Case $full3 = 1 And $full4 = 0 And $full5 = 0; Wenn Blau voll und grün leer, rot erhöhen
    $counterR += 1
    If $counterR = 255 Then $full4 = 1
    Case $full4 = 1 And $full5 = 0; Wenn rot voll, grün erhöhen, um weiß zu erhalten
    $counterG += 1
    If $counterG = 255 Then $full5 = 1
    Case $full5 = 1
    $counterR -= 1
    $counterG -= 1
    $counterB -= 1
    If $counterG = 0 Then
    $counterG = 0
    $counterB = 0
    $counterR = 0
    $full1 = 0
    $full2 = 0
    $full3 = 0
    $full4 = 0
    $full5 = 0
    EndIf
    EndSelect
    Local $Farbe = Hex($counterR, 2) & Hex($counterG, 2) & Hex($counterB, 2)
    _GDIPlus_PenSetColor($Pen1, '0xDD' & $Farbe)
    _GDIPlus_PenSetColor($Pen2, '0x33' & $Farbe)
    EndFunc ;==>_Color

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

    Func _BrushColor()
    If $Alpha1 = 21 Then
    $hochz = 1
    $Alpha1 += 1
    $Alpha2 -= 1
    EndIf

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

    If $Alpha1 = 255 Then
    $hochz = 0
    $Alpha1 -= 1
    $Alpha2 += 1
    EndIf

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

    If $hochz = 1 Then
    $Alpha1 += 1
    $Alpha2 -= 1
    Else
    $Alpha1 -= 1
    $Alpha2 += 1
    EndIf
    _GDIPlus_BrushSetSolidColor($hBrush1, '0x' & Hex($Alpha1, 2) & 'FFFFFF')
    _GDIPlus_BrushSetSolidColor($hBrush2, '0x' & Hex($Alpha2, 2) & 'FFFFFF')
    EndFunc ;==>_BrushColor

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

    Func _GDIPlus_BrushCreateLinear($iX1, $iY1, $iX2, $iY2, $iARGB1 = 0xFF000000, $iARGB2 = 0xFFFFFFFF)
    Local $aResult, $start, $end, $sPoint, $ePoint

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

    $start = DllStructCreate("int X;int Y")
    DllStructSetData($start,"X",$iX1)
    DllStructSetData($start,"Y",$iY1)
    $sPoint = DllStructGetPtr($start)

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

    $end = DllStructCreate("int X;int Y")
    DllStructSetData($end,"X",$iX2)
    DllStructSetData($end,"Y",$iY2)
    $ePoint = DllStructGetPtr($end)

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

    $aResult = DllCall($ghGDIPDll, "int", "GdipCreateLineBrushI", "ptr", $sPoint, "ptr", $ePoint, "int", $iARGB1, "int", $iARGB2, "int", 0, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)

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

    Return SetError(0, $aResult[0], $aResult[6])
    EndFunc ;==>_GDIPlus_BrushCreateLinear

    [/autoit]
  • Ich danke euch beiden, ich hab' ProgAndys Funktion und eine Farbverlaufs-Visualisierung mit Hilfe von Eukalyptus eingebaut.