# Module sdl_gfx

# Imports

sdl

# Types

    PFPSmanager = ptr TFPSmanager

    TFPSmanager = object
      framecount*: uint32
      rateticks*: float32
      lastticks*: uint32
      rate*: uint32

    PColorRGBA = ptr TColorRGBA

    TColorRGBA = object
      r*: Byte
      g*: Byte
      b*: Byte
      a*: Byte

    PColorY = ptr TColorY

    TColorY = object
      y*: Byte

# Consts

    FPS_UPPER_LIMIT = 200

    FPS_LOWER_LIMIT = 1

    FPS_DEFAULT = 30

    SMOOTHING_OFF = 0

    SMOOTHING_ON = 1

# Procs

    proc initFramerate(manager: PFPSmanager) {.cdecl, importc: "SDL_initFramerate",
        dynlib: gfxLibName.}

    proc setFramerate(manager: PFPSmanager; rate: cint): cint {.cdecl,
        importc: "SDL_setFramerate", dynlib: gfxLibName.}

    proc getFramerate(manager: PFPSmanager): cint {.cdecl,
        importc: "SDL_getFramerate", dynlib: gfxLibName.}

    proc framerateDelay(manager: PFPSmanager) {.cdecl,
        importc: "SDL_framerateDelay", dynlib: gfxLibName.}

    proc pixelColor(dst: PSurface; x: int16; y: int16; color: uint32): cint {.cdecl,
        importc: "pixelColor", dynlib: gfxLibName.}

    proc pixelRGBA(dst: PSurface; x: int16; y: int16; r: Byte; g: Byte; b: Byte;
                   a: Byte): cint {.cdecl, importc: "pixelRGBA", dynlib: gfxLibName.}

    proc hlineColor(dst: PSurface; x1: int16; x2: int16; y: int16; color: uint32): cint {.
        cdecl, importc: "hlineColor", dynlib: gfxLibName.}

    proc hlineRGBA(dst: PSurface; x1: int16; x2: int16; y: int16; r: Byte; g: Byte;
                   b: Byte; a: Byte): cint {.cdecl, importc: "hlineRGBA",
        dynlib: gfxLibName.}

    proc vlineColor(dst: PSurface; x: int16; y1: int16; y2: int16; color: uint32): cint {.
        cdecl, importc: "vlineColor", dynlib: gfxLibName.}

    proc vlineRGBA(dst: PSurface; x: int16; y1: int16; y2: int16; r: Byte; g: Byte;
                   b: Byte; a: Byte): cint {.cdecl, importc: "vlineRGBA",
        dynlib: gfxLibName.}

    proc rectangleColor(dst: PSurface; x1: int16; y1: int16; x2: int16; y2: int16;
                        color: uint32): cint {.cdecl, importc: "rectangleColor",
        dynlib: gfxLibName.}

    proc rectangleRGBA(dst: PSurface; x1: int16; y1: int16; x2: int16; y2: int16;
                       r: Byte; g: Byte; b: Byte; a: Byte): cint {.cdecl,
        importc: "rectangleRGBA", dynlib: gfxLibName.}

    proc boxColor(dst: PSurface; x1: int16; y1: int16; x2: int16; y2: int16;
                  color: uint32): cint {.cdecl, importc: "boxColor",
                                         dynlib: gfxLibName.}

    proc boxRGBA(dst: PSurface; x1: int16; y1: int16; x2: int16; y2: int16; r: Byte;
                 g: Byte; b: Byte; a: Byte): cint {.cdecl, importc: "boxRGBA",
        dynlib: gfxLibName.}

    proc lineColor(dst: PSurface; x1: int16; y1: int16; x2: int16; y2: int16;
                   color: uint32): cint {.cdecl, importc: "lineColor",
                                          dynlib: gfxLibName.}

    proc lineRGBA(dst: PSurface; x1: int16; y1: int16; x2: int16; y2: int16;
                  r: Byte; g: Byte; b: Byte; a: Byte): cint {.cdecl,
        importc: "lineRGBA", dynlib: gfxLibName.}

    proc aalineColor(dst: PSurface; x1: int16; y1: int16; x2: int16; y2: int16;
                     color: uint32): cint {.cdecl, importc: "aalineColor",
                                            dynlib: gfxLibName.}

    proc aalineRGBA(dst: PSurface; x1: int16; y1: int16; x2: int16; y2: int16;
                    r: Byte; g: Byte; b: Byte; a: Byte): cint {.cdecl,
        importc: "aalineRGBA", dynlib: gfxLibName.}

    proc circleColor(dst: PSurface; x: int16; y: int16; r: int16; color: uint32): cint {.
        cdecl, importc: "circleColor", dynlib: gfxLibName.}

    proc circleRGBA(dst: PSurface; x: int16; y: int16; rad: int16; r: Byte; g: Byte;
                    b: Byte; a: Byte): cint {.cdecl, importc: "circleRGBA",
        dynlib: gfxLibName.}

    proc aacircleColor(dst: PSurface; x: int16; y: int16; r: int16; color: uint32): cint {.
        cdecl, importc: "aacircleColor", dynlib: gfxLibName.}

    proc aacircleRGBA(dst: PSurface; x: int16; y: int16; rad: int16; r: Byte;
                      g: Byte; b: Byte; a: Byte): cint {.cdecl,
        importc: "aacircleRGBA", dynlib: gfxLibName.}

    proc filledCircleColor(dst: PSurface; x: int16; y: int16; r: int16;
                           color: uint32): cint {.cdecl,
        importc: "filledCircleColor", dynlib: gfxLibName.}

    proc filledCircleRGBA(dst: PSurface; x: int16; y: int16; rad: int16; r: Byte;
                          g: Byte; b: Byte; a: Byte): cint {.cdecl,
        importc: "filledCircleRGBA", dynlib: gfxLibName.}

    proc ellipseColor(dst: PSurface; x: int16; y: int16; rx: int16; ry: int16;
                      color: uint32): cint {.cdecl, importc: "ellipseColor",
        dynlib: gfxLibName.}

    proc ellipseRGBA(dst: PSurface; x: int16; y: int16; rx: int16; ry: int16;
                     r: Byte; g: Byte; b: Byte; a: Byte): cint {.cdecl,
        importc: "ellipseRGBA", dynlib: gfxLibName.}

    proc aaellipseColor(dst: PSurface; xc: int16; yc: int16; rx: int16; ry: int16;
                        color: uint32): cint {.cdecl, importc: "aaellipseColor",
        dynlib: gfxLibName.}

    proc aaellipseRGBA(dst: PSurface; x: int16; y: int16; rx: int16; ry: int16;
                       r: Byte; g: Byte; b: Byte; a: Byte): cint {.cdecl,
        importc: "aaellipseRGBA", dynlib: gfxLibName.}

    proc filledEllipseColor(dst: PSurface; x: int16; y: int16; rx: int16; ry: int16;
                            color: uint32): cint {.cdecl,
        importc: "filledEllipseColor", dynlib: gfxLibName.}

    proc filledEllipseRGBA(dst: PSurface; x: int16; y: int16; rx: int16; ry: int16;
                           r: Byte; g: Byte; b: Byte; a: Byte): cint {.cdecl,
        importc: "filledEllipseRGBA", dynlib: gfxLibName.}

    proc pieColor(dst: PSurface; x: int16; y: int16; rad: int16; start: int16;
                  finish: int16; color: uint32): cint {.cdecl, importc: "pieColor",
        dynlib: gfxLibName.}

    proc pieRGBA(dst: PSurface; x: int16; y: int16; rad: int16; start: int16;
                 finish: int16; r: Byte; g: Byte; b: Byte; a: Byte): cint {.cdecl,
        importc: "pieRGBA", dynlib: gfxLibName.}

    proc filledPieColor(dst: PSurface; x: int16; y: int16; rad: int16; start: int16;
                        finish: int16; color: uint32): cint {.cdecl,
        importc: "filledPieColor", dynlib: gfxLibName.}

    proc filledPieRGBA(dst: PSurface; x: int16; y: int16; rad: int16; start: int16;
                       finish: int16; r: Byte; g: Byte; b: Byte; a: Byte): cint {.
        cdecl, importc: "filledPieRGBA", dynlib: gfxLibName.}

    proc trigonColor(dst: PSurface; x1: int16; y1: int16; x2: int16; y2: int16;
                     x3: int16; y3: int16; color: uint32): cint {.cdecl,
        importc: "trigonColor", dynlib: gfxLibName.}

    proc trigonRGBA(dst: PSurface; x1: int16; y1: int16; x2: int16; y2: int16;
                    x3: int16; y3: int16; r: Byte; g: Byte; b: Byte; a: Byte): cint {.
        cdecl, importc: "trigonRGBA", dynlib: gfxLibName.}

    proc aatrigonColor(dst: PSurface; x1: int16; y1: int16; x2: int16; y2: int16;
                       x3: int16; y3: int16; color: uint32): cint {.cdecl,
        importc: "aatrigonColor", dynlib: gfxLibName.}

    proc aatrigonRGBA(dst: PSurface; x1: int16; y1: int16; x2: int16; y2: int16;
                      x3: int16; y3: int16; r: Byte; g: Byte; b: Byte; a: Byte): cint {.
        cdecl, importc: "aatrigonRGBA", dynlib: gfxLibName.}

    proc filledTrigonColor(dst: PSurface; x1: int16; y1: int16; x2: int16;
                           y2: int16; x3: int16; y3: int16; color: uint32): cint {.
        cdecl, importc: "filledTrigonColor", dynlib: gfxLibName.}

    proc filledTrigonRGBA(dst: PSurface; x1: int16; y1: int16; x2: int16; y2: int16;
                          x3: int16; y3: int16; r: Byte; g: Byte; b: Byte; a: Byte): cint {.
        cdecl, importc: "filledTrigonRGBA", dynlib: gfxLibName.}

    proc polygonColor(dst: PSurface; vx: ptr int16; vy: ptr int16; n: cint;
                      color: uint32): cint {.cdecl, importc: "polygonColor",
        dynlib: gfxLibName.}

    proc polygonRGBA(dst: PSurface; vx: ptr int16; vy: ptr int16; n: cint; r: Byte;
                     g: Byte; b: Byte; a: Byte): cint {.cdecl,
        importc: "polygonRGBA", dynlib: gfxLibName.}

    proc aapolygonColor(dst: PSurface; vx: ptr int16; vy: ptr int16; n: cint;
                        color: uint32): cint {.cdecl, importc: "aapolygonColor",
        dynlib: gfxLibName.}

    proc aapolygonRGBA(dst: PSurface; vx: ptr int16; vy: ptr int16; n: cint;
                       r: Byte; g: Byte; b: Byte; a: Byte): cint {.cdecl,
        importc: "aapolygonRGBA", dynlib: gfxLibName.}

    proc filledPolygonColor(dst: PSurface; vx: ptr int16; vy: ptr int16; n: cint;
                            color: uint32): cint {.cdecl,
        importc: "filledPolygonColor", dynlib: gfxLibName.}

    proc filledPolygonRGBA(dst: PSurface; vx: ptr int16; vy: ptr int16; n: cint;
                           r: Byte; g: Byte; b: Byte; a: Byte): cint {.cdecl,
        importc: "filledPolygonRGBA", dynlib: gfxLibName.}

    proc bezierColor(dst: PSurface; vx: ptr int16; vy: ptr int16; n: cint; s: cint;
                     color: uint32): cint {.cdecl, importc: "bezierColor",
                                            dynlib: gfxLibName.}

    proc bezierRGBA(dst: PSurface; vx: ptr int16; vy: ptr int16; n: cint; s: cint;
                    r: Byte; g: Byte; b: Byte; a: Byte): cint {.cdecl,
        importc: "bezierRGBA", dynlib: gfxLibName.}

    proc characterColor(dst: PSurface; x: int16; y: int16; c: char; color: uint32): cint {.
        cdecl, importc: "characterColor", dynlib: gfxLibName.}

    proc characterRGBA(dst: PSurface; x: int16; y: int16; c: char; r: Byte; g: Byte;
                       b: Byte; a: Byte): cint {.cdecl, importc: "characterRGBA",
        dynlib: gfxLibName.}

    proc stringColor(dst: PSurface; x: int16; y: int16; c: cstring; color: uint32): cint {.
        cdecl, importc: "stringColor", dynlib: gfxLibName.}

    proc stringRGBA(dst: PSurface; x: int16; y: int16; c: cstring; r: Byte; g: Byte;
                    b: Byte; a: Byte): cint {.cdecl, importc: "stringRGBA",
        dynlib: gfxLibName.}

    proc gfxPrimitivesSetFont(fontdata: pointer; cw: cint; ch: cint) {.cdecl,
        importc: "gfxPrimitivesSetFont", dynlib: gfxLibName.}

    proc imageFilterMMXdetect(): cint {.cdecl, importc: "SDL_imageFilterMMXdetect",
                                        dynlib: gfxLibName.}

    proc imageFilterMMXoff() {.cdecl, importc: "SDL_imageFilterMMXoff",
                               dynlib: gfxLibName.}

    proc imageFilterMMXon() {.cdecl, importc: "SDL_imageFilterMMXon",
                              dynlib: gfxLibName.}

    proc imageFilterAdd(Src1: cstring; Src2: cstring; Dest: cstring; len: cint): cint {.
        cdecl, importc: "SDL_imageFilterAdd", dynlib: gfxLibName.}

    proc imageFilterMean(Src1: cstring; Src2: cstring; Dest: cstring; len: cint): cint {.
        cdecl, importc: "SDL_imageFilterMean", dynlib: gfxLibName.}

    proc imageFilterSub(Src1: cstring; Src2: cstring; Dest: cstring; len: cint): cint {.
        cdecl, importc: "SDL_imageFilterSub", dynlib: gfxLibName.}

    proc imageFilterAbsDiff(Src1: cstring; Src2: cstring; Dest: cstring; len: cint): cint {.
        cdecl, importc: "SDL_imageFilterAbsDiff", dynlib: gfxLibName.}

    proc imageFilterMult(Src1: cstring; Src2: cstring; Dest: cstring; len: cint): cint {.
        cdecl, importc: "SDL_imageFilterMult", dynlib: gfxLibName.}

    proc imageFilterMultNor(Src1: cstring; Src2: cstring; Dest: cstring; len: cint): cint {.
        cdecl, importc: "SDL_imageFilterMultNor", dynlib: gfxLibName.}

    proc imageFilterMultDivby2(Src1: cstring; Src2: cstring; Dest: cstring;
                               len: cint): cint {.cdecl,
        importc: "SDL_imageFilterMultDivby2", dynlib: gfxLibName.}

    proc imageFilterMultDivby4(Src1: cstring; Src2: cstring; Dest: cstring;
                               len: cint): cint {.cdecl,
        importc: "SDL_imageFilterMultDivby4", dynlib: gfxLibName.}

    proc imageFilterBitAnd(Src1: cstring; Src2: cstring; Dest: cstring; len: cint): cint {.
        cdecl, importc: "SDL_imageFilterBitAnd", dynlib: gfxLibName.}

    proc imageFilterBitOr(Src1: cstring; Src2: cstring; Dest: cstring; len: cint): cint {.
        cdecl, importc: "SDL_imageFilterBitOr", dynlib: gfxLibName.}

    proc imageFilterDiv(Src1: cstring; Src2: cstring; Dest: cstring; len: cint): cint {.
        cdecl, importc: "SDL_imageFilterDiv", dynlib: gfxLibName.}

    proc imageFilterBitNegation(Src1: cstring; Dest: cstring; len: cint): cint {.
        cdecl, importc: "SDL_imageFilterBitNegation", dynlib: gfxLibName.}

    proc imageFilterAddByte(Src1: cstring; Dest: cstring; len: cint; C: char): cint {.
        cdecl, importc: "SDL_imageFilterAddByte", dynlib: gfxLibName.}

    proc imageFilterAddUint(Src1: cstring; Dest: cstring; len: cint; C: cint): cint {.
        cdecl, importc: "SDL_imageFilterAddUint", dynlib: gfxLibName.}

    proc imageFilterAddByteToHalf(Src1: cstring; Dest: cstring; len: cint; C: char): cint {.
        cdecl, importc: "SDL_imageFilterAddByteToHalf", dynlib: gfxLibName.}

    proc imageFilterSubByte(Src1: cstring; Dest: cstring; len: cint; C: char): cint {.
        cdecl, importc: "SDL_imageFilterSubByte", dynlib: gfxLibName.}

    proc imageFilterSubUint(Src1: cstring; Dest: cstring; len: cint; C: cint): cint {.
        cdecl, importc: "SDL_imageFilterSubUint", dynlib: gfxLibName.}

    proc imageFilterShiftRight(Src1: cstring; Dest: cstring; len: cint; N: char): cint {.
        cdecl, importc: "SDL_imageFilterShiftRight", dynlib: gfxLibName.}

    proc imageFilterShiftRightUint(Src1: cstring; Dest: cstring; len: cint; N: char): cint {.
        cdecl, importc: "SDL_imageFilterShiftRightUint", dynlib: gfxLibName.}

    proc imageFilterMultByByte(Src1: cstring; Dest: cstring; len: cint; C: char): cint {.
        cdecl, importc: "SDL_imageFilterMultByByte", dynlib: gfxLibName.}

    proc imageFilterShiftRightAndMultByByte(Src1: cstring; Dest: cstring; len: cint;
                                            N: char; C: char): cint {.cdecl,
        importc: "SDL_imageFilterShiftRightAndMultByByte", dynlib: gfxLibName.}

    proc imageFilterShiftLeftByte(Src1: cstring; Dest: cstring; len: cint; N: char): cint {.
        cdecl, importc: "SDL_imageFilterShiftLeftByte", dynlib: gfxLibName.}

    proc imageFilterShiftLeftUint(Src1: cstring; Dest: cstring; len: cint; N: char): cint {.
        cdecl, importc: "SDL_imageFilterShiftLeftUint", dynlib: gfxLibName.}

    proc imageFilterShiftLeft(Src1: cstring; Dest: cstring; len: cint; N: char): cint {.
        cdecl, importc: "SDL_imageFilterShiftLeft", dynlib: gfxLibName.}

    proc imageFilterBinarizeUsingThreshold(Src1: cstring; Dest: cstring; len: cint;
                                           T: char): cint {.cdecl,
        importc: "SDL_imageFilterBinarizeUsingThreshold", dynlib: gfxLibName.}

    proc imageFilterClipToRange(Src1: cstring; Dest: cstring; len: cint; Tmin: int8;
                                Tmax: int8): cint {.cdecl,
        importc: "SDL_imageFilterClipToRange", dynlib: gfxLibName.}

    proc imageFilterNormalizeLinear(Src1: cstring; Dest: cstring; len: cint;
                                    Cmin: cint; Cmax: cint; Nmin: cint; Nmax: cint): cint {.
        cdecl, importc: "SDL_imageFilterNormalizeLinear", dynlib: gfxLibName.}

    proc imageFilterConvolveKernel3x3Divide(Src: cstring; Dest: cstring; rows: cint;
                                            columns: cint; Kernel: pointer;
                                            Divisor: int8): cint {.cdecl,
        importc: "SDL_imageFilterConvolveKernel3x3Divide", dynlib: gfxLibName.}

    proc imageFilterConvolveKernel5x5Divide(Src: cstring; Dest: cstring; rows: cint;
                                            columns: cint; Kernel: pointer;
                                            Divisor: int8): cint {.cdecl,
        importc: "SDL_imageFilterConvolveKernel5x5Divide", dynlib: gfxLibName.}

    proc imageFilterConvolveKernel7x7Divide(Src: cstring; Dest: cstring; rows: cint;
                                            columns: cint; Kernel: pointer;
                                            Divisor: int8): cint {.cdecl,
        importc: "SDL_imageFilterConvolveKernel7x7Divide", dynlib: gfxLibName.}

    proc imageFilterConvolveKernel9x9Divide(Src: cstring; Dest: cstring; rows: cint;
                                            columns: cint; Kernel: pointer;
                                            Divisor: int8): cint {.cdecl,
        importc: "SDL_imageFilterConvolveKernel9x9Divide", dynlib: gfxLibName.}

    proc imageFilterConvolveKernel3x3ShiftRight(Src: cstring; Dest: cstring;
        rows: cint; columns: cint; Kernel: pointer; NRightShift: char): cint {.
        cdecl, importc: "SDL_imageFilterConvolveKernel3x3ShiftRight",
        dynlib: gfxLibName.}

    proc imageFilterConvolveKernel5x5ShiftRight(Src: cstring; Dest: cstring;
        rows: cint; columns: cint; Kernel: pointer; NRightShift: char): cint {.
        cdecl, importc: "SDL_imageFilterConvolveKernel5x5ShiftRight",
        dynlib: gfxLibName.}

    proc imageFilterConvolveKernel7x7ShiftRight(Src: cstring; Dest: cstring;
        rows: cint; columns: cint; Kernel: pointer; NRightShift: char): cint {.
        cdecl, importc: "SDL_imageFilterConvolveKernel7x7ShiftRight",
        dynlib: gfxLibName.}

    proc imageFilterConvolveKernel9x9ShiftRight(Src: cstring; Dest: cstring;
        rows: cint; columns: cint; Kernel: pointer; NRightShift: char): cint {.
        cdecl, importc: "SDL_imageFilterConvolveKernel9x9ShiftRight",
        dynlib: gfxLibName.}

    proc imageFilterSobelX(Src: cstring; Dest: cstring; rows: cint; columns: cint): cint {.
        cdecl, importc: "SDL_imageFilterSobelX", dynlib: gfxLibName.}

    proc imageFilterSobelXShiftRight(Src: cstring; Dest: cstring; rows: cint;
                                     columns: cint; NRightShift: char): cint {.
        cdecl, importc: "SDL_imageFilterSobelXShiftRight", dynlib: gfxLibName.}

    proc imageFilterAlignStack() {.cdecl, importc: "SDL_imageFilterAlignStack",
                                   dynlib: gfxLibName.}

    proc imageFilterRestoreStack() {.cdecl, importc: "SDL_imageFilterRestoreStack",
                                     dynlib: gfxLibName.}

    proc rotozoomSurface(src: PSurface; angle: float64; zoom: float64; smooth: cint): PSurface {.
        cdecl, importc: "rotozoomSurface", dynlib: gfxLibName.}

    proc rotozoomSurfaceXY(src: PSurface; angle: float64; zoomx: float64;
                           zoomy: float64; smooth: cint): PSurface {.cdecl,
        importc: "rotozoomSurfaceXY", dynlib: gfxLibName.}

    proc rotozoomSurfaceSize(width: cint; height: cint; angle: float64;
                             zoom: float64; dstwidth: var cint; dstheight: var cint) {.
        cdecl, importc: "rotozoomSurfaceSize", dynlib: gfxLibName.}

    proc rotozoomSurfaceSizeXY(width: cint; height: cint; angle: float64;
                               zoomx: float64; zoomy: float64; dstwidth: var cint;
                               dstheight: var cint) {.cdecl,
        importc: "rotozoomSurfaceSizeXY", dynlib: gfxLibName.}

    proc zoomSurface(src: PSurface; zoomx: float64; zoomy: float64; smooth: cint): PSurface {.
        cdecl, importc: "zoomSurface", dynlib: gfxLibName.}

    proc zoomSurfaceSize(width: cint; height: cint; zoomx: float64; zoomy: float64;
                         dstwidth: var cint; dstheight: var cint) {.cdecl,
        importc: "zoomSurfaceSize", dynlib: gfxLibName.}

Generated: 2013-05-21 09:55:06 UTC