Ответ: Управление цветом с помощью HSL
; ----------------------------------------------------------------------------
; This function takes a color in HSV format and returns a color in RGB format.
; the result is returned in global COLOR property of a Blitz3D engine
; ----------------------------------------------------------------------------
Function HSV__RGB(h#, s#, v#)
If s = 0 Then
r# = g# = b# = v ;grey
Else
h = h / 60
i = Floor(h)
f# = h - i
p# = v * (1 - s)
q# = v * (1 - s * f)
t# = v * (1 - s * (1 - f))
Select i
Case 0
r# = v
g# = t
b# = p
Case 1
r# = q
g# = v
b# = p
Case 2
r# = p
g# = v
b# = t
Case 3
r# = p
g# = q
b# = v
Case 4
r# = t
g# = p
b# = v
Default
r# = v
g# = p
b# = q
End Select
EndIf
Color r, g, b
; Color r * 255, g * 255, b * 255
End Function
Graphics 720,480
For i= 0 To 359
For j = 0 To 15
HSV__RGB(i, 0.5, j*16)
Rect i*2, 20+j*25, 2, 24, True
Next
Next
|