def __init__(self, name="", compositeop=DEFAULT_COMPOSITE_OP): self._surface = tiledsurface.Surface() self.opacity = 1.0 self.name = name self.visible = True self.locked = False self.compositeop = compositeop # Called when contents of layer changed, # with the bounding box of the changed region self.content_observers = [] # Forward from surface implementation self._surface.observers.append(self._notify_content_observers) self.clear()
def __init__(self, name="", compositeop=DEFAULT_COMPOSITE_OP): object.__init__(self) self._surface = tiledsurface.Surface() self.opacity = 1.0 self.name = name self.visible = True self.locked = False self.compositeop = compositeop #: List of content observers #: These callbacks are invoked when the contents of the layer change, #: with the bounding box of the changed region (x, y, w, h). self.content_observers = [] # Forward from surface implementation self._surface.observers.append(self._notify_content_observers) self.clear()
def load_layer_from_png(self, filename, x=0, y=0, feedback_cb=None): s = tiledsurface.Surface() bbox = s.load_from_png(filename, x, y, feedback_cb) self.do(command.LoadLayer(self, s)) return bbox
def load_layer_from_pixbuf(self, pixbuf, x=0, y=0): arr = helpers.gdkpixbuf2numpy(pixbuf) s = tiledsurface.Surface() bbox = s.load_from_numpy(arr, x, y) self.do(command.LoadLayer(self, s)) return bbox