OEImageBase *OECreateWin32GraphicsImage(std::shared_ptr<Gdiplus::Graphics> &graphics);
This function is only available on the Windows operating system through C++.
Returns an new OEImageBase pointer that will forward all the draw commands to the passed in Gdiplus::Graphics object. The user is expected to take ownership and delete the OEImageBase pointer. The OEImageBase will share ownership of the passed in graphics object. It important that the user does not destroy the Gdiplus::Graphics object before the OEImageBase is done with it.
- An OESharedPtr holding ownership of a Gdiplus::Graphics object. Ownership can thus be shared by the caller and the OEImageBase object simultaneously in a thread-safe fashion.
The following code demonstrates how to interact with this function:
ULONG_PTR gdiplusToken; Gdiplus::GdiplusStartupInput startupInput; GdiplusStartup(&gdiplusToken, &startupInput, NULL); OEOwnedPtr<Gdiplus::Bitmap> bitmap(new Bitmap(200, 100, PixelFormat32bppARGB)); std::shared_ptr<Gdiplus::Graphics> graphics(new Graphics(bitmap)); std::unique_ptr<OEImageBase> img(OECreateWin32GraphicsImage(graphics)); OEMol mol; OESmilesToMol(mol, "c1ccccc1 benzene"); OEPrepareDepiction(mol); OERenderMolecule(*img.get(), mol);