# Painting and Drawing

The Painting structure contains functions to control painting and drawing to a window or device context.

    structure Painting :
      sig
      	type HWND and HDC and COLORREF and HRGN

        type RECT = { top: int, left: int, bottom: int, right: int }

        type BinaryRasterOperation
        val R2_BLACK : BinaryRasterOperation
        val R2_COPYPEN : BinaryRasterOperation
        val R2_MASKNOTPEN : BinaryRasterOperation
        val R2_MASKPEN : BinaryRasterOperation
        val R2_MASKPENNOT : BinaryRasterOperation
        val R2_MERGENOTPEN : BinaryRasterOperation
        val R2_MERGEPEN : BinaryRasterOperation
        val R2_MERGEPENNOT : BinaryRasterOperation
        val R2_NOP : BinaryRasterOperation
        val R2_NOT : BinaryRasterOperation
        val R2_NOTCOPYPEN : BinaryRasterOperation
        val R2_NOTMASKPEN : BinaryRasterOperation
        val R2_NOTMERGEPEN : BinaryRasterOperation
        val R2_NOTXORPEN : BinaryRasterOperation
        val R2_WHITE : BinaryRasterOperation
        val R2_XORPEN : BinaryRasterOperation

    	type PAINTSTRUCT =
    		{ hdc: HDC, erase: bool, paint: RECT, private: Word8Vector.vector }

        val BeginPaint : HWND -> HDC * PAINTSTRUCT
        val EndPaint : HWND * PAINTSTRUCT -> unit
        val GdiFlush : unit -> unit
        val GdiGetBatchLimit : unit -> int
        val GdiSetBatchLimit : int -> int
        val GetBkColor : HDC -> COLORREF
        val GetROP2 : HDC -> BinaryRasterOperation
        val GetUpdateRect : HWND * bool -> RECT option
        val GetUpdateRgn : HWND * HRGN * bool -> Region.ResultRegion
        val GetWindowDC : HWND -> HDC
        val InvalidateRgn : HWND * HRGN * bool -> unit
        val SetBkColor : HDC * COLORREF -> COLORREF
        val SetROP2 : HDC * BinaryRasterOperation -> BinaryRasterOperation
        val WindowFromDC : HDC -> HWND
      end