self.strokes = [] # contains StrokeShape instances (not stroke.Stroke)
self._surface.clear()
- def load_from_pixbuf(self, pixbuf):
+ def load_from_surface(self, surface):
self.strokes = []
- self._surface.load_from_data(pixbuf)
+ self._surface.load_from_surface(surface)
def render_as_pixbuf(self, *rect, **kwargs):
- self._surface.render_as_pixbuf(*rect, **kwargs)
+ return self._surface.render_as_pixbuf(*rect, **kwargs)
def save_snapshot(self):
return (self.strokes[:], self._surface.save_snapshot(), self.opacity)
self.strokes = strokes[:]
self._surface.load_snapshot(data)
+
+ def translate(self, dx, dy):
+ """Translate a layer non-interactively.
+ """
+ move = self.get_move(0, 0)
+ move.update(dx, dy)
+ move.process(n=-1)
+ move.cleanup()
+
+
+ def get_move(self, x, y):
+ """Get a translation/move object for this layer.
+ """
+ return self._surface.get_move(x, y)
+
+
def add_stroke(self, stroke, snapshot_before):
before = snapshot_before[1] # extract surface snapshot
after = self._surface.save_snapshot()
shape.brush_string = stroke.brush_settings
self.strokes.append(shape)
+
def save_strokemap_to_file(self, f, translate_x, translate_y):
brush2id = {}
for stroke in self.strokes: