summaryrefslogtreecommitdiff
path: root/embroider_simulate.py
diff options
context:
space:
mode:
authorLex Neva <github.com@lexneva.name>2018-01-05 21:58:22 -0500
committerLex Neva <github.com@lexneva.name>2018-01-06 15:11:57 -0500
commit8d8e886d8b63e65d7ad99757ec6ebab4b5303f09 (patch)
treebe1175682807fa09c664bce8d5470cd9b29ffd28 /embroider_simulate.py
parent56aeabd9a64948eeeb446e2d95cdf39006258182 (diff)
add scale parameter in simulate
Diffstat (limited to 'embroider_simulate.py')
-rw-r--r--embroider_simulate.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/embroider_simulate.py b/embroider_simulate.py
index b602f569..33c0159e 100644
--- a/embroider_simulate.py
+++ b/embroider_simulate.py
@@ -16,6 +16,7 @@ class EmbroiderySimulator(wx.Frame):
self.frame_period = kwargs.pop('frame_period', 80)
self.stitches_per_frame = kwargs.pop('stitches_per_frame', 1)
self.target_duration = kwargs.pop('target_duration', None)
+ self.scale = 1
wx.Frame.__init__(self, *args, **kwargs)
@@ -27,7 +28,7 @@ class EmbroiderySimulator(wx.Frame):
if self.target_duration:
self.adjust_speed(self.target_duration)
- self.buffer = wx.Bitmap(self.width, self.height)
+ self.buffer = wx.Bitmap(self.width * self.scale, self.height * self.scale)
self.dc = wx.MemoryDC()
self.dc.SelectObject(self.buffer)
self.canvas = wx.GraphicsContext.Create(self.dc)
@@ -163,7 +164,7 @@ class EmbroiderySimulator(wx.Frame):
if symbol == "$":
red, green, blue = fields[2:5]
- color = self.color_to_pen((int(red), int(green), int(blue)))
+ pen = self.color_to_pen((int(red), int(green), int(blue)))
elif symbol == "*":
if command == "COLOR":
# change color
@@ -263,7 +264,7 @@ class EmbroiderySimulator(wx.Frame):
decorations_width = window_width - client_width
decorations_height = window_height - client_height
- self.SetSize((self.width + decorations_width, self.height + decorations_height))
+ self.SetSize((self.width * self.scale + decorations_width, self.height * self.scale + decorations_height))
e.Skip()
@@ -288,6 +289,11 @@ class EmbroiderySimulator(wx.Frame):
y1 = self.height - y1
y2 = self.height - y2
+ x1 = x1 * self.scale
+ y1 = y1 * self.scale
+ x2 = x2 * self.scale
+ y2 = y2 * self.scale
+
self.canvas.SetPen(color)
self.canvas.DrawLines(((x1, y1), (x2, y2)))
self.Refresh()