self.maxy = p.y
if p.y < self.miny:
self.miny = p.y
- def finish(self):
+ def finish(self, div = 3):
# if aspect ratio is bad, we adjust max/min accordingly
# before setting [xy][12]. We don't change self.min/max
# as they are used to place stroke in bigger bbox.
+ # Normally divisions are at 1/3 and 2/3. They can be moved
+ # by setting div e.g. 2 = 1/2 and 1/2
(minx,miny,maxx,maxy) = (self.minx,self.miny,self.maxx,self.maxy)
if (maxx - minx) * 3 < (maxy - miny) * 2:
# too narrow
miny = mid - halfheight
maxy = mid + halfheight
- self.x1 = int((2*minx + maxx)/3)
- self.x2 = int((minx + 2*maxx)/3)
- self.y1 = int((2*miny + maxy)/3)
- self.y2 = int((miny + 2*maxy)/3)
+ div1 = div - 1
+ self.x1 = int((div1*minx + maxx)/div)
+ self.x2 = int((minx + div1*maxx)/div)
+ self.y1 = int((div1*miny + maxy)/div)
+ self.y2 = int((miny + div1*maxy)/div)
def row(self, p):
# 0, 1, 2 - top to bottom
alloc = self.page.get_allocation()
pagebb = BBox(Point(0,0))
pagebb.add(Point(alloc.width, alloc.height))
- pagebb.finish()
+ pagebb.finish(div = 2)
p = PPath(self.line[1][0], self.line[1][1])
for pp in self.line[1:]: