|
@@ -13,12 +13,12 @@ import math,cairo,random
|
|
|
|
|
|
def plotSquares(ctx):
|
|
|
global rsum
|
|
|
- for i in xrange(1,w):
|
|
|
+ for i in xrange(0,w-1):
|
|
|
|
|
|
rsum += i*rs # add to the random value
|
|
|
-
|
|
|
+ ctx.save()
|
|
|
ctx.translate(s*i, 0)
|
|
|
- for j in xrange(1,h):
|
|
|
+ for j in xrange(0,h-1):
|
|
|
|
|
|
rv = random.uniform(-rsum, rsum)
|
|
|
# here comes the box :-)
|
|
@@ -34,19 +34,23 @@ def plotSquares(ctx):
|
|
|
# draw the damn box
|
|
|
# plotter.write(box)
|
|
|
#
|
|
|
- ctx.translate(0, s*j)
|
|
|
+ ctx.translate(rs*dp*i, s)
|
|
|
#ctx.rotate(math.pi * 1 / 4)
|
|
|
+ ctx.save()
|
|
|
ctx.rotate(rv)
|
|
|
ctx.rectangle(0,0, s, s)
|
|
|
+ ctx.restore()
|
|
|
ctx.stroke()
|
|
|
-
|
|
|
+ ctx.restore()
|
|
|
|
|
|
|
|
|
#float RGB touple
|
|
|
FG_RGB_COLOR=(0,0,0)
|
|
|
#A4 in 300 DPI
|
|
|
width, height = 3508,2480
|
|
|
-w = 1 # width (how many squares - es. 22)
|
|
|
+offsetX, offsetY = 100,500
|
|
|
+
|
|
|
+w = 10 # width (how many squares - es. 22)
|
|
|
h = 12 # height (how many squares - es. 12)
|
|
|
s = 100 # square size (es. 15)
|
|
|
|
|
@@ -62,7 +66,7 @@ ctx = cairo.Context (surface)
|
|
|
|
|
|
ctx.set_source_rgb(FG_RGB_COLOR[0],FG_RGB_COLOR[1],FG_RGB_COLOR[2])
|
|
|
ctx.set_line_width(1)
|
|
|
-ctx.translate(100, 500)
|
|
|
+ctx.translate(offsetX, offsetY)
|
|
|
plotSquares(ctx)
|
|
|
|
|
|
|