i want to write bitmaps into 3dm files using write3dmbitmap( ) function. Is there any example ?
My problem is that i can’t cast CrhinoBitmap or create a functional ON_Bitmap to use the above function. ON_Bitmap has to be overridden but i can’t follow Rhino SDK help to myself.
Searching in docs i found that CRhinoBitmap class can’t be instantiated because has it’s constructor in the private section and i must use bitmaptables through CRhinoDoc class. Right ?
I’m using CRhinoDoc::m_bitmaptable to store some custom bitmaps. Can i have separate CRhinoBitmap classes in order to be used anywhere ?
Does CRhinoDoc stores bitmap table to 3dm file automatically or i have to force it ?
If i store bitmap to 3dm (using write3dmbitmap) then how can i read it back ? read3dmbitmap needs an ON_Bitmap pointer pointer and It’s ok so far. Does this pointer has to point to an already reserved bitmap or not ? Can you provide me a simple example ? Is CRhinoBitmapTable::AddBitmap (ON_Bitmap*, bool) enough ?
I’m using
const CRhinoBitmap *r = doc.m_bitmap_table.Bitmap(L"C:\Users\Mike\Desktop\index.jpg", true);
const ON_Bitmap *b = r->Bitmap(); //Not safe for now but it’s not NULL for tests
if(b==NULL || r==NULL)
RhinoApp().Print(L"Failed accuire bitmap");
else
RhinoApp().Print(b->m_bitmap_filename); //Goes here, means that none of the above pointers are NULL
if(archive.Write3dmBitmap( *b ) == false)
RhinoApp().Print(L"Failed to write bitmap"); //Finally archive doesn’t write bitmap to 3dm