Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/ep_layer_filledspline.py
diff options
context:
space:
mode:
authorNostalghia <b.vehikel@googlemail.com>2010-06-17 17:44:13 (GMT)
committer Nostalghia <b.vehikel@googlemail.com>2010-06-17 17:44:13 (GMT)
commitcdcf15300bc69b07b41a6e93e84ba9492f3caeb6 (patch)
tree4e1adf7dec48360ba44ca5acf57e6160f35a4954 /ep_layer_filledspline.py
parentad2d12f3e64dc7ada866d750ebf08f3cad8f9a91 (diff)
Fixing bugs in the rendering engine.
Diffstat (limited to 'ep_layer_filledspline.py')
-rw-r--r--ep_layer_filledspline.py36
1 files changed, 19 insertions, 17 deletions
diff --git a/ep_layer_filledspline.py b/ep_layer_filledspline.py
index bc4e24b..b645e08 100644
--- a/ep_layer_filledspline.py
+++ b/ep_layer_filledspline.py
@@ -168,25 +168,27 @@ class FilledSpline(model_layer.Layer):
px, py = self.center.x_pos, self.center.y_pos
ctx.move_to(px, py)
points = self.sampler.get_sample_points()
- for index, step_0 in enumerate(points):
- if index < 2:
- ctx.move_to(px, py)
+ for index in xrange(len(points)):
+ if index == 0:
+ pass
+ elif index == 1:
+ ctx.move_to(px+points[index][0], py+points[index][1])
elif index == len(points)-1:
- ctx.move_to(px, py)
+ pass
else:
- step_p1 = (px+points[index+1][0], py+points[index+1][1])
- step_m1 = (px+points[index-1][0], py+points[index-1][1])
- step_m2 = (px+points[index-2][0], py+points[index-2][1])
- sp_delta_x = self.roundness * (step_m1[0] - step_m2[0])
- sp_delta_y = self.roundness * (step_m1[1] - step_m2[1])
- ap_delta_x = step_0[0] - step_m1[0]
- ap_delta_y = step_0[1] - step_m1[1]
- np_delta_x = self.roundness * (step_p1[0] - step_0[0])
- np_delta_y = self.roundness * (step_p1[1] - step_0[1])
- ctx.rel_curve_to (ap_delta_x-np_delta_x,
- ap_delta_y-np_delta_y, # end control point
- sp_delta_x, sp_delta_y, # start control point
- ap_delta_x, ap_delta_y) # end point
+ end_x, end_y = points[index][0], points[index][1]
+ cstart_x = points[index-1][0] - self.roundness * (points[index-1][0]-points[index-2][0])
+ cstart_y = points[index-1][1] - self.roundness * (points[index-1][1]-points[index-2][1])
+ cend_x = end_x + self.roundness * (points[index+1][0]-end_x)
+ cend_y = end_y + self.roundness * (points[index+1][1]-end_y)
+# cstart_x = (points[index-1][0]+points[index-2][0])
+# cstart_y = (points[index-1][1]+points[index-2][1])
+# cend_x = (points[index+1][0]+end_x)
+# cend_y = (points[index+1][1]+end_y)
+ ctx.curve_to (px+cend_x, py+cend_y, # end control point
+ px+cstart_x, py+cstart_y, # start control point
+ px+end_x, py+end_y) # end point
+# print str(ctx.copy_path())
rgba = self.fillcolor.rgba
ctx.set_source_rgba(rgba[0], rgba[1], rgba[2], rgba[3])
ctx.fill_preserve()