go-libwebp

Experimental translation from libwebp to Go source.
Log | Files | Refs | README | LICENSE

libwebp.py (8209B)


      1 # This file was automatically generated by SWIG (http://www.swig.org).
      2 # Version 3.0.12
      3 #
      4 # Do not make changes to this file unless you know what you are doing--modify
      5 # the SWIG interface file instead.
      6 
      7 from sys import version_info as _swig_python_version_info
      8 if _swig_python_version_info >= (2, 7, 0):
      9     def swig_import_helper():
     10         import importlib
     11         pkg = __name__.rpartition('.')[0]
     12         mname = '.'.join((pkg, '_libwebp')).lstrip('.')
     13         try:
     14             return importlib.import_module(mname)
     15         except ImportError:
     16             return importlib.import_module('_libwebp')
     17     _libwebp = swig_import_helper()
     18     del swig_import_helper
     19 elif _swig_python_version_info >= (2, 6, 0):
     20     def swig_import_helper():
     21         from os.path import dirname
     22         import imp
     23         fp = None
     24         try:
     25             fp, pathname, description = imp.find_module('_libwebp', [dirname(__file__)])
     26         except ImportError:
     27             import _libwebp
     28             return _libwebp
     29         try:
     30             _mod = imp.load_module('_libwebp', fp, pathname, description)
     31         finally:
     32             if fp is not None:
     33                 fp.close()
     34         return _mod
     35     _libwebp = swig_import_helper()
     36     del swig_import_helper
     37 else:
     38     import _libwebp
     39 del _swig_python_version_info
     40 
     41 try:
     42     _swig_property = property
     43 except NameError:
     44     pass  # Python < 2.2 doesn't have 'property'.
     45 
     46 try:
     47     import builtins as __builtin__
     48 except ImportError:
     49     import __builtin__
     50 
     51 def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
     52     if (name == "thisown"):
     53         return self.this.own(value)
     54     if (name == "this"):
     55         if type(value).__name__ == 'SwigPyObject':
     56             self.__dict__[name] = value
     57             return
     58     method = class_type.__swig_setmethods__.get(name, None)
     59     if method:
     60         return method(self, value)
     61     if (not static):
     62         if _newclass:
     63             object.__setattr__(self, name, value)
     64         else:
     65             self.__dict__[name] = value
     66     else:
     67         raise AttributeError("You cannot add attributes to %s" % self)
     68 
     69 
     70 def _swig_setattr(self, class_type, name, value):
     71     return _swig_setattr_nondynamic(self, class_type, name, value, 0)
     72 
     73 
     74 def _swig_getattr(self, class_type, name):
     75     if (name == "thisown"):
     76         return self.this.own()
     77     method = class_type.__swig_getmethods__.get(name, None)
     78     if method:
     79         return method(self)
     80     raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
     81 
     82 
     83 def _swig_repr(self):
     84     try:
     85         strthis = "proxy of " + self.this.__repr__()
     86     except __builtin__.Exception:
     87         strthis = ""
     88     return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
     89 
     90 try:
     91     _object = object
     92     _newclass = 1
     93 except __builtin__.Exception:
     94     class _object:
     95         pass
     96     _newclass = 0
     97 
     98 
     99 def WebPGetDecoderVersion():
    100     """WebPGetDecoderVersion() -> int"""
    101     return _libwebp.WebPGetDecoderVersion()
    102 
    103 def WebPGetInfo(data):
    104     """WebPGetInfo(uint8_t data) -> (width, height)"""
    105     return _libwebp.WebPGetInfo(data)
    106 
    107 def WebPDecodeRGB(data):
    108     """WebPDecodeRGB(uint8_t data) -> (rgb, width, height)"""
    109     return _libwebp.WebPDecodeRGB(data)
    110 
    111 def WebPDecodeRGBA(data):
    112     """WebPDecodeRGBA(uint8_t data) -> (rgb, width, height)"""
    113     return _libwebp.WebPDecodeRGBA(data)
    114 
    115 def WebPDecodeARGB(data):
    116     """WebPDecodeARGB(uint8_t data) -> (rgb, width, height)"""
    117     return _libwebp.WebPDecodeARGB(data)
    118 
    119 def WebPDecodeBGR(data):
    120     """WebPDecodeBGR(uint8_t data) -> (rgb, width, height)"""
    121     return _libwebp.WebPDecodeBGR(data)
    122 
    123 def WebPDecodeBGRA(data):
    124     """WebPDecodeBGRA(uint8_t data) -> (rgb, width, height)"""
    125     return _libwebp.WebPDecodeBGRA(data)
    126 
    127 def WebPGetEncoderVersion():
    128     """WebPGetEncoderVersion() -> int"""
    129     return _libwebp.WebPGetEncoderVersion()
    130 
    131 def wrap_WebPEncodeRGB(rgb, unused1, unused2, width, height, stride, quality_factor):
    132     """private, do not call directly."""
    133     return _libwebp.wrap_WebPEncodeRGB(rgb, unused1, unused2, width, height, stride, quality_factor)
    134 
    135 def wrap_WebPEncodeBGR(rgb, unused1, unused2, width, height, stride, quality_factor):
    136     """private, do not call directly."""
    137     return _libwebp.wrap_WebPEncodeBGR(rgb, unused1, unused2, width, height, stride, quality_factor)
    138 
    139 def wrap_WebPEncodeRGBA(rgb, unused1, unused2, width, height, stride, quality_factor):
    140     """private, do not call directly."""
    141     return _libwebp.wrap_WebPEncodeRGBA(rgb, unused1, unused2, width, height, stride, quality_factor)
    142 
    143 def wrap_WebPEncodeBGRA(rgb, unused1, unused2, width, height, stride, quality_factor):
    144     """private, do not call directly."""
    145     return _libwebp.wrap_WebPEncodeBGRA(rgb, unused1, unused2, width, height, stride, quality_factor)
    146 
    147 def wrap_WebPEncodeLosslessRGB(rgb, unused1, unused2, width, height, stride):
    148     """private, do not call directly."""
    149     return _libwebp.wrap_WebPEncodeLosslessRGB(rgb, unused1, unused2, width, height, stride)
    150 
    151 def wrap_WebPEncodeLosslessBGR(rgb, unused1, unused2, width, height, stride):
    152     """private, do not call directly."""
    153     return _libwebp.wrap_WebPEncodeLosslessBGR(rgb, unused1, unused2, width, height, stride)
    154 
    155 def wrap_WebPEncodeLosslessRGBA(rgb, unused1, unused2, width, height, stride):
    156     """private, do not call directly."""
    157     return _libwebp.wrap_WebPEncodeLosslessRGBA(rgb, unused1, unused2, width, height, stride)
    158 
    159 def wrap_WebPEncodeLosslessBGRA(rgb, unused1, unused2, width, height, stride):
    160     """private, do not call directly."""
    161     return _libwebp.wrap_WebPEncodeLosslessBGRA(rgb, unused1, unused2, width, height, stride)
    162 
    163 _UNUSED = 1
    164 
    165 
    166 def WebPEncodeRGB(rgb, width, height, stride, quality_factor):
    167   """WebPEncodeRGB(uint8_t rgb, int width, int height, int stride, float quality_factor) -> lossy_webp"""
    168   webp = wrap_WebPEncodeRGB(
    169       rgb, _UNUSED, _UNUSED, width, height, stride, quality_factor)
    170   if len(webp[0]) == 0:
    171     return None
    172   return webp[0]
    173 
    174 
    175 def WebPEncodeRGBA(rgb, width, height, stride, quality_factor):
    176   """WebPEncodeRGBA(uint8_t rgb, int width, int height, int stride, float quality_factor) -> lossy_webp"""
    177   webp = wrap_WebPEncodeRGBA(
    178       rgb, _UNUSED, _UNUSED, width, height, stride, quality_factor)
    179   if len(webp[0]) == 0:
    180     return None
    181   return webp[0]
    182 
    183 
    184 def WebPEncodeBGR(rgb, width, height, stride, quality_factor):
    185   """WebPEncodeBGR(uint8_t rgb, int width, int height, int stride, float quality_factor) -> lossy_webp"""
    186   webp = wrap_WebPEncodeBGR(
    187       rgb, _UNUSED, _UNUSED, width, height, stride, quality_factor)
    188   if len(webp[0]) == 0:
    189     return None
    190   return webp[0]
    191 
    192 
    193 def WebPEncodeBGRA(rgb, width, height, stride, quality_factor):
    194   """WebPEncodeBGRA(uint8_t rgb, int width, int height, int stride, float quality_factor) -> lossy_webp"""
    195   webp = wrap_WebPEncodeBGRA(
    196       rgb, _UNUSED, _UNUSED, width, height, stride, quality_factor)
    197   if len(webp[0]) == 0:
    198     return None
    199   return webp[0]
    200 
    201 
    202 def WebPEncodeLosslessRGB(rgb, width, height, stride):
    203   """WebPEncodeLosslessRGB(uint8_t rgb, int width, int height, int stride) -> lossless_webp"""
    204   webp = wrap_WebPEncodeLosslessRGB(rgb, _UNUSED, _UNUSED, width, height, stride)
    205   if len(webp[0]) == 0:
    206     return None
    207   return webp[0]
    208 
    209 
    210 def WebPEncodeLosslessRGBA(rgb, width, height, stride):
    211   """WebPEncodeLosslessRGBA(uint8_t rgb, int width, int height, int stride) -> lossless_webp"""
    212   webp = wrap_WebPEncodeLosslessRGBA(rgb, _UNUSED, _UNUSED, width, height, stride)
    213   if len(webp[0]) == 0:
    214     return None
    215   return webp[0]
    216 
    217 
    218 def WebPEncodeLosslessBGR(rgb, width, height, stride):
    219   """WebPEncodeLosslessBGR(uint8_t rgb, int width, int height, int stride) -> lossless_webp"""
    220   webp = wrap_WebPEncodeLosslessBGR(rgb, _UNUSED, _UNUSED, width, height, stride)
    221   if len(webp[0]) == 0:
    222     return None
    223   return webp[0]
    224 
    225 
    226 def WebPEncodeLosslessBGRA(rgb, width, height, stride):
    227   """WebPEncodeLosslessBGRA(uint8_t rgb, int width, int height, int stride) -> lossless_webp"""
    228   webp = wrap_WebPEncodeLosslessBGRA(rgb, _UNUSED, _UNUSED, width, height, stride)
    229   if len(webp[0]) == 0:
    230     return None
    231   return webp[0]
    232 
    233 # This file is compatible with both classic and new-style classes.
    234 
    235