# This file was automatically generated by SWIG (http://www.swig.org).
# Version 1.3.40
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
# This file is compatible with both classic and new-style classes.

from sys import version_info
if version_info >= (2,6,0):
    def swig_import_helper():
        from os.path import dirname
        import imp
        fp = None
        try:
            fp, pathname, description = imp.find_module('_plat_support', [dirname(__file__)])
        except ImportError:
            import _plat_support
            return _plat_support
        if fp is not None:
            try:
                _mod = imp.load_module('_plat_support', fp, pathname, description)
            finally:
                fp.close()
            return _mod
    _plat_support = swig_import_helper()
    del swig_import_helper
else:
    import _plat_support
del version_info
try:
    _swig_property = property
except NameError:
    pass # Python < 2.2 doesn't have 'property'.
def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
    if (name == "thisown"): return self.this.own(value)
    if (name == "this"):
        if type(value).__name__ == 'SwigPyObject':
            self.__dict__[name] = value
            return
    method = class_type.__swig_setmethods__.get(name,None)
    if method: return method(self,value)
    if (not static) or hasattr(self,name):
        self.__dict__[name] = value
    else:
        raise AttributeError("You cannot add attributes to %s" % self)

def _swig_setattr(self,class_type,name,value):
    return _swig_setattr_nondynamic(self,class_type,name,value,0)

def _swig_getattr(self,class_type,name):
    if (name == "thisown"): return self.this.own()
    method = class_type.__swig_getmethods__.get(name,None)
    if method: return method(self)
    raise AttributeError(name)

def _swig_repr(self):
    try: strthis = "proxy of " + self.this.__repr__()
    except: strthis = ""
    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)

try:
    _object = object
    _newclass = 1
except AttributeError:
    class _object : pass
    _newclass = 0


from numpy import ndarray

def is_array(obj):
    return type(obj) is ndarray

def is_correct_type(obj, numeric_type):
    return is_array(obj) and (obj.dtype == numeric_type)

def numpy_check(obj, typecode,
                exact_size = [],
                must_be_contiguous = 1,
                allow_coersion = 0):

    if is_correct_type(obj, typecode):
        ary = obj
    elif allow_coersion:
        ary = asarray(obj,typecode)
    else:
        raise TypeError, "input is not an array or the array has the wrong type"

    if must_be_contiguous and not ary.flags["CONTIGUOUS"]:
        if allow_coersion:
            ary = ary.copy()
        else:
            raise TypeError, "input array must be contiguous"

    # check number of dimensions
    required_dims = len(exact_size)
    if required_dims and required_dims != len(ary.shape):
        raise ValueError, "The input array does not have the correct shape"

    # check exact shape of each dimension
    cnt = 0
    for desired,actual in zip(exact_size,ary.shape):
        if desired != -1 and desired != actual:
            raise ValueError, "The %d dimensions of the array has the wrong shape" % (cnt)
        cnt += 1

    return ary

pix_format_undefined = _plat_support.pix_format_undefined
pix_format_gray8 = _plat_support.pix_format_gray8
pix_format_rgb555 = _plat_support.pix_format_rgb555
pix_format_rgb565 = _plat_support.pix_format_rgb565
pix_format_rgb24 = _plat_support.pix_format_rgb24
pix_format_bgr24 = _plat_support.pix_format_bgr24
pix_format_rgba32 = _plat_support.pix_format_rgba32
pix_format_argb32 = _plat_support.pix_format_argb32
pix_format_abgr32 = _plat_support.pix_format_abgr32
pix_format_bgra32 = _plat_support.pix_format_bgra32
end_of_pix_formats = _plat_support.end_of_pix_formats
class PixelMap(_object):
    __swig_setmethods__ = {}
    __setattr__ = lambda self, name, value: _swig_setattr(self, PixelMap, name, value)
    __swig_getmethods__ = {}
    __getattr__ = lambda self, name: _swig_getattr(self, PixelMap, name)
    __repr__ = _swig_repr
    __swig_destroy__ = _plat_support.delete_PixelMap
    __del__ = lambda self : None;
    def __init__(self, *args): 
        this = _plat_support.new_PixelMap(*args)
        try: self.this.append(this)
        except: self.this = this
    def draw(self, *args): return _plat_support.PixelMap_draw(self, *args)
    def convert_to_argb32string(self): return _plat_support.PixelMap_convert_to_argb32string(self)
    def set_bmp_array(self):
         self.bmp_array = pixel_map_as_unowned_array(self)
         return self

    def draw_to_tkwindow(self, window, x, y):
        window_id = window._tk_widget.winfo_id()
        hdc = GetDC(window_id)
        self.draw(hdc, x, y)
        ReleaseDC(window_id, hdc)
        return

    def draw_to_wxwindow(self, window, x, y, width=-1, height=-1):
        window_dc = getattr(window,'_dc',None)
        if window_dc is None:
            window_dc = wx.PaintDC(window)
        self.draw(window_dc.GetHDC(), x, y, width, height)
        return

      
PixelMap_swigregister = _plat_support.PixelMap_swigregister
PixelMap_swigregister(PixelMap)


def pixel_map_as_unowned_array(*args):
  return _plat_support.pixel_map_as_unowned_array(*args)
pixel_map_as_unowned_array = _plat_support.pixel_map_as_unowned_array

def GetDC(*args):
  return _plat_support.GetDC(*args)
GetDC = _plat_support.GetDC

def ReleaseDC(*args):
  return _plat_support.ReleaseDC(*args)
ReleaseDC = _plat_support.ReleaseDC


