diff options
author | Walter Bender <walter@sugarlabs.org> | 2011-02-07 14:05:17 (GMT) |
---|---|---|
committer | Walter Bender <walter@sugarlabs.org> | 2011-02-07 14:05:17 (GMT) |
commit | 0f6ec143612b29306e20b0512a8b1ea3b2cb7662 (patch) | |
tree | c8be9298a63a252cb228860d123c9f2617c58f83 /TurtleArt/tacanvas.py | |
parent | 050957fe8e2d62d5d89a538c5750edd90900ab29 (diff) |
trying base64 for draw_pixbuf sharing
Diffstat (limited to 'TurtleArt/tacanvas.py')
-rw-r--r-- | TurtleArt/tacanvas.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/TurtleArt/tacanvas.py b/TurtleArt/tacanvas.py index 8f12f61..952fc25 100644 --- a/TurtleArt/tacanvas.py +++ b/TurtleArt/tacanvas.py @@ -501,21 +501,22 @@ class TurtleGraphics: y, w, h, path, image_to_base64(pixbuf, get_path(self.tw.activity, 'instance'))) else: + # Outside of Sugar, we save a path self.tw.svg_string += self.svg.image(x - self.width / 2, y, w, h, path) if self.tw.sharing(): - data = pixbuf.get_pixels() + if self.tw.running_sugar: + tmp_path = get_path(self.tw.activity, 'instance') + else: + tmp_path = '/tmp' + data = image_to_base64(pixbuf, tmp_path) height = pixbuf.get_height() width = pixbuf.get_width() - stride = pixbuf.get_rowstride() - bits_per_sample = pixbuf.get_bits_per_sample() - has_alpha = pixbuf.get_has_alpha() - colorspace = pixbuf.get_colorspace() event = "P|%s" % (data_to_string([self._get_my_nick(), [round_int(a), round_int(b), round_int(x), round_int(y), round_int(w), round_int(h), - width, height, stride, bits_per_sample, - has_alpha, colorspace, data]])) + round_int(width), round_int(height), + data]])) self._send_event(event, share) def draw_text(self, label, x, y, size, w, share=True): |