A memory device context provides a means to draw graphics onto a bitmap. Notice that the memory DC must be deleted (or the bitmap selected out of it) before a bitmap can be reselected into another memory DC. And, before performing any other operations on the bitmap data, the bitmap must be selected out of the memory DC:

temp_dc.selectObject(wNilBitmap) # here wNilBitmap is a predefined bitmap

Like other DC object, wMemoryDC need nim's destructors to release the resource.



proc selectObject(self: var wMemoryDC; bitmap: wBitmap) {...}{.raises: [], tags: [].}
Selects the given bitmap into the device context, to use as the memory bitmap.
proc MemoryDC(): wMemoryDC {...}{.raises: [], tags: [].}
Constructs a new memory device context.
proc MemoryDC(dc: wDC): wMemoryDC {...}{.raises: [], tags: [].}
Constructs a new memory device context compatible with the specified device.
proc delete(self: var wMemoryDC) {...}{.raises: [], tags: [].}
Nim's destructors will delete this object by default. However, sometimes you maybe want to do that by yourself. (Nim's destructors don't work in some version?)