[Libreoffice-commits] core.git: librelogo/source
László Németh
laszlo.nemeth at collabora.com
Sun May 17 17:47:17 PDT 2015
librelogo/source/LibreLogo/LibreLogo.py | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
New commits:
commit 2ca7795a6a723c701f295323fcc3f6c52ad37976
Author: László Németh <laszlo.nemeth at collabora.com>
Date: Mon May 18 02:43:45 2015 +0200
LibreLogo: CLOSE closes, FILL fills points, too
Example: drawing square within a circle:
PENUP
REPEAT 4 [
FORWARD 100
POINT
BACK 100
RIGHT 360/4
] FILL
CIRCLE 200
Change-Id: Ica3ce44306fc985717ff73e8a3dec5dddf69f19b
diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py
index 6229c15..327648c 100644
--- a/librelogo/source/LibreLogo/LibreLogo.py
+++ b/librelogo/source/LibreLogo/LibreLogo.py
@@ -103,6 +103,7 @@ class __Doc__:
self.fontheight = 12
self.fontweight = 100
self.fontstyle = 0
+ self.points = []
from math import pi, sin, cos, asin, sqrt, log10
@@ -930,6 +931,8 @@ def __go__(shapename, n, dot = False, preciseAngle = -1):
return
if not _.pen and not dot:
return
+ if _.pen and not dot:
+ _.points = [] # new line drawing: forget the points
shape = __draw__("PolyLineShape")
shape.RotateAngle = 0
shape.PolyPolygon = tuple([tuple([__Point__(0, 0)])])
@@ -964,8 +967,21 @@ def __go__(shapename, n, dot = False, preciseAngle = -1):
def __fillit__(filled = True):
oldshape = __getshape__(__ACTUAL__)
- if oldshape and oldshape.LineStartCenter:
- __removeshape__(__ACTUAL__) # FIXME close dotted polyline
+ if (oldshape and oldshape.LineStartCenter) or _.points:
+ if oldshape:
+ __removeshape__(__ACTUAL__) # FIXME close dotted polyline
+ if _.points:
+ p = position()
+ h = heading()
+ for i in _.points:
+ position(i)
+ __pen__(1)
+ __checkhalt__()
+ _.points = []
+ __fillit__(filled)
+ __pen__(0)
+ position(p)
+ heading(h)
return
if oldshape and "LineShape" in oldshape.ShapeType:
shape = __draw__("PolyPolygonShape", False)
@@ -1016,6 +1032,7 @@ def point():
oldstyle, _.linestyle = _.linestyle, __LineStyle_DOTTED__
__go__(__TURTLE__, 0, True)
_.pen, _.linestyle = oldpen, oldstyle
+ _.points.append(position())
def __boxshape__(shapetype, l):
turtle = __getshape__(__TURTLE__)
More information about the Libreoffice-commits
mailing list