algorithmic modeling for Rhino
Tags:
Doc.DrawToDC
or Doc.RenderToDC
, which is the method that's doing the capturing if you will. What that method needs is a device context to write the data to. In the example it uses the MRhinoDib class, which looks pretty lean on the dotNET side. I'm not sure if its possible to create your own device context to draw to, but the one in the RhinoSDK only has a WriteToFile method. Since you're probably looking to access the data directly, as opposed to writing the file and reading it back in, I don't think this is going to be as helpful.Private Sub RunScript(ByRef A As Object)
RMA.Rhino.RhUtil.RhinoApp().RunScript("-_ViewCaptureToClipboard _Enter")
Dim img As Image = Windows.Forms.Clipboard.GetImage()
Dim bmp As New Bitmap(20, 20, Imaging.PixelFormat.Format24bppRgb)
Dim grp As Graphics = Graphics.FromImage(bmp)
grp.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
grp.DrawImage(img, 0, 0, 20, 20)
Dim R As int32 = 0
Dim G As int32 = 0
Dim B As Int32 = 0
For i As Int32 = 0 To bmp.Width - 1
For j As Int32 = 0 To bmp.Height - 1
Dim col As Color = bmp.GetPixel(i, j)
R += col.R
G += col.G
B += col.B
Next
Next
R = Convert.ToInt32(R / 400)
G = Convert.ToInt32(G / 400)
B = Convert.ToInt32(B / 400)
A = Color.FromArgb(R, G, B)
End Sub
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by