Hello,
apologies if this was asked before or is self-evident -
is there a way to read in the underlying bitmap of a Rhino.DocObjects.Texture
object from an in-memory System.Drawing.Bitmap
instead of getting the bitmap from an image file or file reference?
So far, using the Texture.Filename property
works but setting that property results in reading the image from disk. Instead, it would be great to be able to read the image from a bitmap object instead.
Thx.
See if this will work for you (Rhino 6 and later)
Hi Nathan, thanks for the answer, I got it to work using the following:
readonly Rhino.Display.DisplayMaterial m_material = new Rhino.Display.DisplayMaterial(); readonly static Rhino.Display.DisplayBitmap favi = new DisplayBitmap(Properties.Resources.imagename);
and then
var rt = Rhino.Render.RenderTexture.NewBitmapTexture(viri, Rhino.RhinoDoc.ActiveDoc);
var text = SimulatedTexture(Rhino.Render.RenderTexture.TextureGeneration.Allow).Texture();
so, the key was to first create a simulated texture.
2 Likes