Forklaring af kode
Jeg fik følgende kode af olebole, men forstår ikke helt tankegangen, jeg vil meget gerne have den forklaret (helst af olebole :)) På forhånd tak :)Private Sub ColorPicker(R As Integer, G As Integer, B As Integer)
Dim X As Integer
Dim Y As Integer
Dim xR As Single
Dim xG As Single
Dim xB As Single
Dim yR As Single
Dim yG As Single
Dim yB As Single
Dim pR As Integer
Dim pG As Integer
Dim pB As Integer
For Y = 0 To 255
For X = 255 To 0 Step -1
yR = R - (R / 255) * Y
yG = G - (G / 255) * Y
yB = B - (B / 255) * Y
xR = (255 - (yR + Y)) / 255
xG = (255 - (yG + Y)) / 255
xB = (255 - (yB + Y)) / 255
pR = yR + (xR * (255 - X))
pG = yG + (xG * (255 - X))
pB = yB + (xB * (255 - X))
Picture1.PSet (X, Y), RGB(pR, pG, pB)
Next X
Next Y
For Y = 0 To 255
hsb2rgb 360 - ((360 / 255) * Y), 100, 100
For X = 0 To 20
Picture2.PSet (X, Y), RGB(rgbA(0), rgbA(1), rgbA(2))
Next X
Next Y
Picture1.Visible = True
Picture2.Visible = True
End Sub
Spørgsmålet hvor jeg fik koden er her: http://www.eksperten.dk/spm/589381
