Changeset 4405 for libcaca/trunk


Ignore:
Timestamp:
Jun 20, 2010, 11:32:31 PM (9 years ago)
Author:
Alex Foulon
Message:
  • Fix export functions.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/python/caca/canvas.py

    r4404 r4405  
    889889        """ Export a canvas into a foreign format.
    890890
    891             fmt -- a string describing the input format
     891            fmt -- a string describing the output format
    892892
    893893            Valid values for format are:
     
    904904        #initialize pointer
    905905        p_size_t = ctypes.POINTER(ctypes.c_size_t)
    906 
    907906        _lib.caca_export_canvas_to_memory.argtypes = [
    908907                _Canvas, ctypes.c_char_p, p_size_t
    909908        ]
    910         _lib.caca_export_canvas_to_memory.restype  = ctypes.c_void_p
    911 
    912         ret = _lib.caca_export_canvas_to_memory(self, fmt,
    913                                                 p_size_t(ctypes.c_size_t()))
    914         return ctypes.c_char_p(ret).value
     909        _lib.caca_export_canvas_to_memory.restype  = ctypes.POINTER(ctypes.c_char_p)
     910
     911        p = ctypes.c_size_t()
     912        ret = _lib.caca_export_canvas_to_memory(self, fmt, p)
     913
     914        return ctypes.string_at(ret, p.value)
    915915
    916916    def export_area_to_memory(self, x, y, width, height, fmt):
     
    921921            width   -- the width of the area to export
    922922            height  -- the height of the area to export
    923             fmt     -- a string describing the input format
     923            fmt     -- a string describing the output format
    924924
    925925            Valid values for format are:
     
    943943        _lib.caca_export_area_to_memory.restype  = ctypes.c_void_p
    944944
    945         ret = _lib.caca_export_area_to_memory(self, x, y, width, height,
    946                                               fmt, p_size_t(ctypes.c_size_t()))
    947         return ctypes.c_char_p(ret).value
     945        p = ctypes.c_size_t()
     946        ret = _lib.caca_export_area_to_memory(self, x, y, width, height, fmt, p)
     947
     948        return ctypes.string_at(ret, p.value)
    948949
    949950class NullCanvas(_Canvas):
Note: See TracChangeset for help on using the changeset viewer.