<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<!-- THIS FILE IS GENERATED DO NOT EDIT -->


<erlref>
<header>
  <copyright>
    <year>2020</year><year>2021</year>
    <holder>wxWidgets team.</holder></copyright>
  <legalnotice>Licensed under the wxWindows Free Documentation Licence, Version 3
  </legalnotice>
  <title>wxMemoryDC</title>
</header>
<module>wxMemoryDC</module>
<modulesummary>Functions for wxMemoryDC class</modulesummary>
<description><p>A memory device context provides a means to draw graphics onto a bitmap. When drawing in to a mono-bitmap, using <c>wxWHITE</c>, <c>wxWHITE_PEN</c> and <c>wxWHITE_BRUSH</c> will draw the background colour (i.e. 0) whereas all other colours will draw the foreground colour (i.e. 1).
      </p><p>A bitmap must be selected into the new memory DC before it may be used for anything. Typical usage is as follows:
      </p><p>Note that the memory DC must be deleted (or the bitmap selected out of it) before a bitmap can be reselected into another memory DC.
      </p><p>And, before performing any other operations on the bitmap data, the bitmap must be selected out of the memory DC:
      </p><p>This happens automatically when <seeerl marker="wxMemoryDC"><c>wxMemoryDC</c></seeerl> object goes out of scope.
      </p><p>See: <seeerl marker="wxBitmap"><c>wxBitmap</c></seeerl>, <seeerl marker="wxDC"><c>wxDC</c></seeerl>
      </p>
  <p>This class is derived (and can use functions) from: 
    <seeerl marker="wxDC"><c>wxDC</c></seeerl></p>
  
  <p>wxWidgets docs: <url href="https://docs.wxwidgets.org/3.1/classwx_memory_d_c.html">wxMemoryDC</url></p>
  </description>
<datatypes><datatype><name name="wxMemoryDC"/></datatype></datatypes>

<funcs>
  <func>
    <name name="new" arity="0" clause_i="1" since=""/>
    <fsummary>Constructs a new memory device context. </fsummary>
    <desc><p>Constructs a new memory device context. 
      </p><p>Use the <seemfa marker="wxDC#isOk/1"><c>wxDC:isOk/1</c></seemfa> member to test whether the constructor was successful in creating a usable device context. Don't forget to select a bitmap into the DC before drawing on it. 
      </p></desc>
  </func>
  
  <func>
    <name name="new" arity="1" clause_i="1" since=""/>
    <fsummary>Constructs a new memory device context having the same characteristics as the given existing device context. </fsummary>
    <desc><p>Constructs a new memory device context having the same characteristics as the given existing device context. 
      </p><p>This constructor creates a memory device context <c>compatible</c> with <c>dc</c> in wxMSW, the argument is ignored in the other ports. If <c>dc</c> is NULL, a device context compatible with the screen is created, just as with the default constructor. 
      </p></desc>
  </func>
  
  <func>
    <name name="selectObject" arity="2" clause_i="1" since=""/>
    <fsummary>Works exactly like <c>selectObjectAsSource/2</c> but this is the function you should use when you select a bitmap because you want to modify it, e.g. </fsummary>
    <desc><p>Works exactly like <seemfa marker="#selectObjectAsSource/2"><c>selectObjectAsSource/2</c></seemfa> but this is the function you should use when you select a bitmap because you want to modify it, e.g. 
      </p><p>drawing on this DC.
      </p><p>Using <seemfa marker="#selectObjectAsSource/2"><c>selectObjectAsSource/2</c></seemfa> when modifying the bitmap may incur some problems related to <seeerl marker="wxBitmap"><c>wxBitmap</c></seeerl> being a reference counted object (see overview_refcount).
      </p><p>Before using the updated bitmap data, make sure to select it out of context first either by selecting ?wxNullBitmap into the device context or destroying the device context entirely.
      </p><p>If the bitmap is already selected in this device context, nothing is done. If it is selected in another context, the function asserts and drawing on the bitmap won't work correctly.
      </p><p>See: <seemfa marker="wxDC#drawBitmap/4"><c>wxDC:drawBitmap/4</c></seemfa>
      </p></desc>
  </func>
  
  <func>
    <name name="selectObjectAsSource" arity="2" clause_i="1" since=""/>
    <fsummary>Selects the given bitmap into the device context, to use as the memory bitmap. </fsummary>
    <desc><p>Selects the given bitmap into the device context, to use as the memory bitmap. 
      </p><p>Selecting the bitmap into a memory DC allows you to draw into the DC (and therefore the bitmap) and also to use <seemfa marker="wxDC#blit/6"><c>wxDC:blit/6</c></seemfa> to copy the bitmap to a window. For this purpose, you may find <seemfa marker="wxDC#drawIcon/3"><c>wxDC:drawIcon/3</c></seemfa> easier to use instead.
      </p><p>If the argument is ?wxNullBitmap (or some other uninitialised <seeerl marker="wxBitmap"><c>wxBitmap</c></seeerl>) the current bitmap is selected out of the device context, and the original bitmap restored, allowing the current bitmap to be destroyed safely. 
      </p></desc>
  </func>
  
  <func>
    <name name="destroy" arity="1" clause_i="1" since=""/>
    <fsummary>Destructor</fsummary>
    <desc><p>Destroys the object.</p></desc>
  </func>
  </funcs>
</erlref>
