tools.choose(tools.PEN) tools.mouse(line_buf) line_buf = [] DEG_TO_RAD = math.pi / 180 ANGLE = abs(dialog.input_value("Angle (< 90)", 45)) if ANGLE >= 90: dialog.show_message("Invalid angle") DEFAULT_SIZE_Y = 7 * 8 / 2 * 2 * (1.14 + math.cos(ANGLE * DEG_TO_RAD)) / 2.14 MULTIPLIER = image.get_height() / DEFAULT_SIZE_Y ZOOM = dialog.input_value("Vertical size (%)", 95) MULTIPLIER = MULTIPLIER * ZOOM / 100 def drawTree(x1, y1, angle, depth): if (depth > 0): x2 = x1 + (math.cos(angle * DEG_TO_RAD) * depth * MULTIPLIER) y2 = y1 + (math.sin(angle * DEG_TO_RAD) * depth * MULTIPLIER) line(x1, y1, x2, y2) drawTree(x2, y2, angle - ANGLE, depth - 2) drawTree(x2, y2, angle + ANGLE, depth - 2) image.do_begin() layer.new() drawTree(image.get_width() / 2, image.get_height(), -90, 14) flush_line() image.do_end()
from lazpaint import image, layer, filters for i in range(1, image.get_layer_count() + 1): image.select_layer_index(i) filters.twirl(radius=min(image.get_width(), image.get_height()) / 2, angle=360)
from lazpaint import tools, image, layer, dialog def line(x, y, x2, y2): tools.choose(tools.PEN) tools.mouse([(x, y), (x2, y2)]) ZOOM = dialog.input_value( "Zoom (Between 0.1 and 0.4 it creates a 3d room, more than 0.5 to 0.9 it creates a cross with a rectangle)", 0.25) image.do_begin() layer.new() w = image.get_width() h = image.get_height() #top left line(0, 0, w * ZOOM, h * ZOOM) #bottom left line(0, h, w * ZOOM, h - (h * ZOOM)) #top right line(w, 0, w - (w * ZOOM), h * ZOOM) #bottom right line(w, h, w - (w * ZOOM), h - (h * ZOOM)) #top line(w * ZOOM, h * ZOOM, w - (w * ZOOM), h * ZOOM) #bottom line(w * ZOOM, h - (h * ZOOM), w - (w * ZOOM), h - (h * ZOOM)) #left line(w * ZOOM, h * ZOOM, w * ZOOM, h - (h * ZOOM))