B:BD[
4.590] → [
10.32:108]
∅:D[
11.66] → [
6.2485:2520]
∅:D[
10.108] → [
6.2485:2520]
∅:D[
4.658] → [
6.2485:2520]
B:BD[
6.2485] → [
6.2485:2520]
B:BD[
6.2520] → [
9.76:153]
B:BD[
9.153] → [
3.642:700]
∅:D[
7.695] → [
6.2566:2601]
∅:D[
3.700] → [
6.2566:2601]
∅:D[
12.1239] → [
6.2566:2601]
B:BD[
6.2566] → [
6.2566:2601]
B:BD[
6.2601] → [
10.109:175]
B:BD[
10.175] → [
5.490:528]
∅:D[
5.528] → [
13.121:168]
B:BD[
13.121] → [
13.121:168]
B:BD[
13.168] → [
5.529:579]
B:BD[
5.617] → [
5.617:683]
∅:D[
5.683] → [
13.168:236]
B:BD[
13.168] → [
13.168:236]
∅:D[
11.137] → [
6.2663:2711]
∅:D[
15.162] → [
6.2663:2711]
∅:D[
10.220] → [
6.2663:2711]
∅:D[
13.236] → [
6.2663:2711]
∅:D[
4.801] → [
6.2663:2711]
B:BD[
6.2663] → [
6.2663:2711]
m = OUTPUT_SCALE
dx, dy = (PADDING, PADDING)
im = Image.new('RGB', (self.width * m + dx, self.height * m + dy))
draw = ImageDraw.Draw(im)
draw.rectangle((0, 0, self.width * m, self.height * m), FILL_COLOR)
for quad in self.root.get_leaf_nodes(max_depth):
l, t, r, b = quad.box
box = (l * m + dx, t * m + dy, r * m - 1, b * m - 1)
if MODE == MODE_ELLIPSE:
draw.ellipse(box, quad.color)
elif MODE == MODE_ROUNDED_RECTANGLE:
radius = m * min((r - l), (b - t)) / 4
rounded_rectangle(draw, box, radius, quad.color)
else:
draw.rectangle(box, quad.color)
del draw
im.save(path, 'PNG')
m = OUTPUT_SCALE
dx, dy = (PADDING, PADDING)
im = Image.new('RGB', (self.width * m + dx, self.height * m + dy))
draw = ImageDraw.Draw(im)
draw.rectangle((0, 0, self.width * m, self.height * m), FILL_COLOR)
svg_root = ET.Element("svg")
svg_root.set("xmlns", "http://www.w3.org/2000/svg")
svg_root.set("viewBox", "0 0 " + str(self.width + PADDING) + " " + str(self.height + PADDING))
svg_root.set("width", str((self.width + PADDING) * m))
svg_root.set("height", str((self.height + PADDING) * m))
svg_title = ET.SubElement(svg_root, "title")
svg_title.text = self.filename
svg_rect = ET.SubElement(svg_root, "rect")
svg_rect.set("x", "0")
svg_rect.set("y", "0")
svg_rect.set("width", "100%") #str(self.width * m))
svg_rect.set("height", "100%") #str(self.height * m))
svg_rect.set("fill", "rgb(" + str(FILL_COLOR[0]) + ", " + str(FILL_COLOR[1]) + ", " + str(FILL_COLOR[2]) + ")")
svg_contents = ET.SubElement(svg_root, "g")
for quad in self.root.get_leaf_nodes(max_depth):
l, t, r, b = quad.box
box = (l * m + dx, t * m + dy, r * m - 1, b * m - 1)
if MODE == MODE_ELLIPSE:
draw.ellipse(box, quad.color)
svg_rect = ET.SubElement(svg_contents, "rect")
svg_rect.set("x", str(quad.box[0] + PADDING))
svg_rect.set("y", str(quad.box[1] + PADDING))
svg_rect.set("rx", "100%")
svg_rect.set("ry", "100%")
svg_rect.set("width", str(quad.box[2] - (quad.box[0] + PADDING)))
svg_rect.set("height",str(quad.box[3] - (quad.box[1] + PADDING)))
svg_rect.set("fill", "rgb(" + str(quad.color[0]) + ", " + str(quad.color[1]) + ", " + str(quad.color[2]) + ")")
elif MODE == MODE_ROUNDED_RECTANGLE:
radius = m * min((r - l), (b - t)) / 4
rounded_rectangle(draw, box, radius, quad.color)
svg_rect = ET.SubElement(svg_contents, "rect")
svg_rect.set("x", str(quad.box[0] + PADDING))
svg_rect.set("y", str(quad.box[1] + PADDING))
svg_rect.set("rx", str(radius))
svg_rect.set("ry", str(radius))
svg_rect.set("width", str(quad.box[2] - (quad.box[0] + PADDING)))
svg_rect.set("height",str(quad.box[3] - (quad.box[1] + PADDING)))
svg_rect.set("fill", "rgb(" + str(quad.color[0]) + ", " + str(quad.color[1]) + ", " + str(quad.color[2]) + ")")