def check_line(self, x, y, cx, cy): for dx, dy in line.draw_line(cx, cy, x, y): if x == dx and y == dy: continue if not self.level[dx, dy].walkable: return False return True
def draw_shape(canvas, shape): if type(shape) == Circle: draw_circle(canvas, shape.bbox, shape.rad) elif type(shape) == Line: draw_line(canvas, shape.bbox, shape.m)
line.save_lines('output/lines_v.csv', lines_v) line.save_lines('output/lines_h.csv', lines_h) else: lines_v = line.read_lines('output/lines_v.csv') lines_h = line.read_lines('output/lines_h.csv') # divide blocks if is_block: blocks_h = l2b.divide_blocks_by_lines(lines_h, org.shape[0], C.BLOCK_MIN_HEIGHT) if is_code: # calculate the hierarchy among blocks hierarchies_h = l2b.hierarchy_blocks(blocks_h) # generate code according to hierarchy html = code.gen_html(blocks_h, hierarchies_h) # save results broad_line = np.zeros(org.shape, dtype=np.uint8) broad_block = np.zeros(org.shape, dtype=np.uint8) line.draw_line(broad_line, lines_h, (0, 255, 0)) line.draw_line(broad_line, lines_v, (0, 0, 255)) l2b.draw_blocks(broad_block, blocks_h, hierarchies_h, 'output/blocks/') cv2.imwrite('output/line.png', broad_line) cv2.imwrite('output/grad.png', binary) cv2.imwrite('output/org.png', org) open('output/x.html', 'w').write(html) print('*** Time:%.3f ***' % (time.clock() - start))
terminal.printf(x, y + 7, "[color={0}]Color11".format(color11)) terminal.printf(x + 8, y + 7, "blend({1}) [color={0}]Color12".format(color12, 0.75)) terminal.printf(x + 28, y + 7, "= [color={0}]NewColor".format(color11.blend(color12, 0.75))) terminal.printf(x, y + 8, "[color={0}]Color11".format(color11)) terminal.printf(x + 8, y + 8, "blend({1}) [color={0}]Color12".format(color12, 1.00)) terminal.printf(x + 28, y + 8, "= [color={0}]NewColor".format(color11.blend(color12, 1.00))) #bline = b_line.get_line(l1, l2) key = None terminal.color('yellow') terminal.printf(l1[0] - 1, l1[1], '>') color10 = bltColor('sky') line.draw_line((l1[0], l1[1]), (l2[0], l2[1]), color10) terminal.color(bltColor('255, 255,64,64')) terminal.print_(15, 8, "[wrap=25x5][align=left-bottom]Hello my name is rudy!!!!!!!! I want to be your friend") terminal.color('yellow') terminal.printf(l2[0] + 1, l2[1], '<') terminal.refresh() if terminal.has_input(): key = terminal.read()