Guten Abend,
ich hab hier eine Funktion:
Spoiler anzeigen
Func ColorGradient($hInitialColor, $hFinalColor, $iReturnSize)
$hInitialColor = Hex($hInitialColor, 6)
$hFinalColor = Hex($hFinalColor, 6)
Local $iRed1 = Dec(StringLeft($hInitialColor, 2))
Local $iGreen1 = Dec(StringMid($hInitialColor, 3, 2))
Local $iBlue1 = Dec(StringMid($hInitialColor, 5, 2))
Local $iRed2 = Dec(StringLeft($hFinalColor, 2))
Local $iGreen2 = Dec(StringMid($hFinalColor, 3, 2))
Local $iBlue2 = Dec(StringMid($hFinalColor, 5, 2))
Local $iPlusRed = ($iRed2 - $iRed1) / ($iReturnSize - 1)
Local $iPlusBlue = ($iBlue2 - $iBlue1) / ($iReturnSize - 1)
Local $iPlusGreen = ($iGreen2 - $iGreen1) / ($iReturnSize - 1)
Dim $iColorArray[$iReturnSize]
For $i = 0 To $iReturnSize - 1
$iNowRed = Floor($iRed1 + ($iPlusRed * $i))
$iNowBlue = Floor($iBlue1 + ($iPlusBlue * $i))
$iNowGreen = Floor($iGreen1 + ($iPlusGreen * $i))
$iColorArray[$i] = Dec(Hex($iNowRed, 2) & Hex($iNowGreen, 2) & Hex($iNowBlue, 2))
Next
Return ($iColorArray)
EndFunc ;==>ColorGradient
dass einen Farbverlauf von Farbe a nach b berechnet und alle einzelne Farben als Array zurück gibt. Also die Rückgabewerte sind z.b. 3881263. Da ich diesen Farbverlauf für ein GDI+ Script brauche, muss ich das in so etwas umwandeln: 0xFF3A4FF6. Nun ich komm leider die ganze Zeit schon nicht drauf, wie man aus einer Zahl soetwas macht.
Hier ein Stück aus meinem Code:
Spoiler anzeigen
Local $AnzahlLinien = ($Hoehe - 7) + 2
Local $Array = ColorGradient(RandomColor(), RandomColor(), $AnzahlLinien)
Local $pen = _GDIPlus_PenCreate("0xFF" & $Array[0])
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_GraphicsDrawLine($capGraph, 3, 2, $breite - 4, 2, $pen)
[/autoit] [autoit][/autoit] [autoit]For $i = 0 To $Hoehe - 7
$pen = _GDIPlus_PenCreate("0xFF" & $Array[$i + 1])
_GDIPlus_GraphicsDrawLine($capGraph, 2, 3 + $i, $breite - 3, 3 + $i, $pen)
Next
$pen = _GDIPlus_PenCreate("0xFF" & $Array[$AnzahlLinien - 1])
_GDIPlus_GraphicsDrawLine($capGraph, 3, $Hoehe - 3, $breite - 4, $Hoehe - 3, $pen)
Ich hab bei Zeile 9 versucht die "0xFF" einfach als String anzuhängen, aber das funktioniert nicht.