Ignore:
Timestamp:
Jun 21, 2010, 8:06:26 PM (11 years ago)
Author:
Alex Foulon
Message:
  • Add optional pointer argument to Canvas class.
  • get_canvas method now return Python Canvas object.
File:
1 edited

Legend:

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

    r4405 r4408  
    5757        first parameter.
    5858    """
    59     def __init__(self, width=0, height=0):
     59    def __init__(self, width=0, height=0, pointer=None):
    6060        """ Canvas constructor.
    6161
    6262            width   -- the desired canvas width
    6363            height  -- the desired canvas height
     64            cv      -- pointer to libcaca canvas
    6465        """
    6566        _lib.caca_create_canvas.argtypes = [ctypes.c_int, ctypes.c_int]
    6667
    67         self._cv = _lib.caca_create_canvas(width, height)
    68         if self._cv == 0:
    69             raise CanvasError, "Failed to create canvas"
     68        if cv is not None:
     69            self._cv = _lib.caca_create_canvas(width, height)
     70            if self._cv == 0:
     71                raise CanvasError, "Failed to create canvas"
     72        else:
     73            self._cv = cv
    7074
    7175    def manage(self, *args, **kw):
     
    941945                ctypes.c_char_p, p_size_t
    942946        ]
    943         _lib.caca_export_area_to_memory.restype  = ctypes.c_void_p
     947        _lib.caca_export_area_to_memory.restype  = ctypes.POINTER(ctypes.c_char_p)
    944948
    945949        p = ctypes.c_size_t()
Note: See TracChangeset for help on using the changeset viewer.