.. oe:namespace:: OEDepict

.. meta::
   :keywords: OECreateWin32GraphicsImage

.. _OEDepict_OECreateWin32GraphicsImage:


.. oe:function:: OECreateWin32GraphicsImage


   .. oe:language:: c++

      .. oe:api::

         OEImageBase* OECreateWin32GraphicsImage(std::shared_ptr<Gdiplus::Graphics>& graphics)

      .. note::

         This function is only available on the Windows operating
         system through C++.

      Returns an new :ref:`OEImageBase <OEDepict_OEImageBase>` pointer that will
      forward all the draw commands to the passed in
      `GDI+ Graphics class <http://msdn.microsoft.com/en-us/library/windows/desktop/ms534453(v=vs.85).aspx>`_
      object. The user is expected to take ownership and delete the
      :ref:`OEImageBase <OEDepict_OEImageBase>` pointer. The
      :ref:`OEImageBase <OEDepict_OEImageBase>` will share ownership of the
      passed in graphics object. It important that the user does not
      destroy the `Gdiplus::Graphics <http://msdn.microsoft.com/en-us/library/windows/desktop/ms534453(v=vs.85).aspx>`_
      object before the :ref:`OEImageBase <OEDepict_OEImageBase>` is done with it.

      *graphics*
        An :ref:`OESharedPtr <OESystem_OESharedPtr>` holding ownership of a
        `Gdiplus::Graphics <http://msdn.microsoft.com/en-us/library/windows/desktop/ms534453(v=vs.85).aspx>`_ object. 
        Ownership can thus be shared by the caller and the :ref:`OEImageBase <OEDepict_OEImageBase>` object
        simultaneously in a thread-safe fashion.


      The following code demonstrates how to interact with this
      function:

      .. oe:source:: OECreateWin32GraphicsImage.cpp
         :language: c++
         :noindent:
         :frag:     SNIPPET-OECREATEWIN32GRAPHICSIMAGE

   .. oe:language:: csharp java python

      .. note::

         This function is only available on the Windows operating
         system through C++.
