Hi,
I would like to translate a BezierPath, without changing it's bounds.
Here is code where you can see my problem.
newPage(2000,2000)
# Grey Rectangle
path0 = BezierPath()
path0.rect(1000,10,200,1990)
with savedState():
fill(0, 0.1)
drawPath(path0)
# Green Rectangle
path1 = BezierPath()
path1.text("1", fontSize=200)
with savedState():
fill(0,1,0)
rect(*path1.bounds())
drawPath(path1)
# Red Rectangle
path2 = BezierPath()
path2.text("2", fontSize=200, offset=(200,300))
with savedState():
fill(1,0,0)
rect(*path2.bounds())
drawPath(path2)
# Yellow Rectangle
path3 = BezierPath()
path3.text("3", fontSize=200)
path3.translate(100,800)
with savedState():
fill(1,1,0)
rect(*path3.bounds())
drawPath(path3)
# Magenta Rectangle
translate(900,800)
path4 = BezierPath()
path4.text("4", fontSize=200)
with savedState():
fill(1,0,1)
rect(*path4.bounds())
drawPath(path4)
I tested 3 solution:
-
use offset in path.text
Change BezierPath bounds
-
use path.translate
Change BezierPath bounds
-
use translate
Don't change BezierPath bounds
But this is annoying, because I don't want to translate all my canvas just for that.
So what is the solution ?