# Transform

The Transform structure contains functions to apply various co-ordinate transforms within a window or device context.

    structure Transform:
      sig
    	type HDC
    	type HWND
    	type POINT = { x: int, y: int }
    	type SIZE = { cx: int, cy: int }
        datatype Fraction = Fraction of {num: int, denom: int}

        datatype
          MapMode =
              MM_ANISOTROPIC
            | MM_HIENGLISH
            | MM_HIMETRIC
            | MM_ISOTROPIC
            | MM_LOENGLISH
            | MM_LOMETRIC
            | MM_TEXT
            | MM_TWIPS
        val MM_MAX : MapMode
        val MM_MAX_FIXEDSCALE : MapMode
        val MM_MIN : MapMode

    	type XForm = { m11: real, m12: real, m21: real, m22: real, dx: real, dy: real }

        type XFormType
        val MWT_IDENTITY : XFormType
        val MWT_LEFTMULTIPLY : XFormType
        val MWT_MAX : XFormType
        val MWT_MIN : XFormType
        val MWT_RIGHTMULTIPLY : XFormType

        type GraphicsMode
        val GM_ADVANCED : GraphicsMode
        val GM_COMPATIBLE : GraphicsMode
        val GM_ERROR : GraphicsMode

        val ClientToScreen : HWND * POINT -> POINT
        val CombineTransform : XForm * XForm -> XForm
        val DPtoLP : HDC * POINT list -> POINT list
        val GetCurrentPositionEx : HDC -> POINT
        val GetGraphicsMode : HDC -> GraphicsMode
        val GetMapMode : HDC -> MapMode
        val GetViewportExtEx : HDC -> SIZE
        val GetViewportOrgEx : HDC -> POINT
        val GetWindowExtEx : HDC -> SIZE
        val GetWindowOrgEx : HDC -> POINT
        val GetWorldTransform : HDC -> XForm
        val LPtoDP : HDC * POINT list -> POINT list
        val MapWindowPoints : HWND * HWND * POINT list -> POINT list
        val ModifyWorldTransform : HDC * XForm * XFormType -> unit
        val OffsetViewportOrgEx : HDC * int * int -> unit * POINT
        val OffsetWindowOrgEx : HDC * int * int -> unit * POINT
        val ScaleViewportExtEx : HWND * Fraction * Fraction -> SIZE
        val ScaleWindowExtEx : HWND * Fraction * Fraction -> SIZE
        val ScreenToClient : HWND * POINT -> POINT
        val SetGraphicsMode : HDC * GraphicsMode -> GraphicsMode
        val SetMapMode : HDC * MapMode -> MapMode
        val SetViewportExtEx : HDC * int * int -> unit * SIZE
        val SetViewportOrgEx : HDC * int * int -> unit * POINT
        val SetWindowExtEx : HDC * int * int -> unit * SIZE
        val SetWindowOrgEx : HDC * int * int -> unit * POINT
        val SetWorldTransform : HDC * XForm -> unit

      end