Skip to content

Commit

Permalink
image should be modified, hard coded image file name so far
Browse files Browse the repository at this point in the history
  • Loading branch information
lingruiluo committed Jul 10, 2020
1 parent f540615 commit 819830c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions jp_doodle/svg_translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,18 @@ def polygon(self, points, color, fill=True, close = True, lineWidth=1, **other_a
**atts
)

def image(self, x, y, w, h, image_name, **other_arguments_ignored):
# href is hard coded
(x, y) = self.canvas_to_svg_axis(x, y)
self.add_draw_tag(
tag_name="image",
href = image_name+".png",
x = x,
y = y-h,
height = h,
width = w
)

def add_draw_tag(self, tag_name, body=None, **attributes):
accum = []
add = accum.append
Expand All @@ -196,6 +208,8 @@ def interpret_dump(canvas_dump):
else:
assert svg_interp is not None, "Canvas description must come before draw commands."
method = getattr(svg_interp, shape_name, None)
if shape_name == "named_image":
method = svg_interp.image
if method is None:
print ("SVG draw method not yet defined: " + repr(shape_name))
else:
Expand Down

0 comments on commit 819830c

Please sign in to comment.