
Option explicit
Call Main()
Sub Main()
Dim strCrv
strCrv = Rhino.GetObject("Select a gradient curve", 4, True)
If isNull(strCrv) Then Exit Sub
Dim arrFace(0), arrVertices(3)
Dim i, x, arrLine, arrCX, arrP, lngColor, H, arrC, j
Dim RhPicture
Set RhPicture = Rhino.GetPluginObject("RhPicture")
Call RhPicture.CreateImage(200, 255, vbWhite)
For i=0 To 255
x = i / 25.5
arrLine = array(array(x, 0, 0), array(x, 10, 0))
arrCX = Rhino.LineCurveIntersection(arrLine, strCrv)
If isArray(arrCX) Then
arrP = arrCX(0, 1)
H = round(arrP(1) * 25.5)
lngColor = RGB(H, H, H)
For j=0 To 200
Call RhPicture.SetPixel(j, 255 - i, lngColor)
Next
End If
Next
Call RhPicture.ShowImage("Black&White Gradient")
Set RhPicture = Nothing
End Sub
No comments:
Post a Comment