def apply_stroke(): global stroke_done, opacity_done, stroke_initial_color if opacity_done: image.undo() opacity_done = False if stroke_done: image.undo() stroke_done = False image.do_begin() if chosen_radius > 0.5: layer.duplicate() disk_id = layer.get_id() filters.blur(name=filters.BLUR_DISK, radius=chosen_radius-0.5) filters.filter_function(red=overlay_color.red/255, green=overlay_color.green/255, blue=overlay_color.blue/255, alpha="min(alpha*"+str(chosen_radius*5)+",(1-alpha)*"+str(chosen_radius*5)+")", gamma_correction=False) layer.select_id(stroke_layer_id) else: disk_id = None filters.blur(name=filters.BLUR_CORONA, radius=chosen_radius+0.5) filters.filter_function(red=overlay_color.red/255, green=overlay_color.green/255, blue=overlay_color.blue/255, alpha="min(alpha*"+str(chosen_radius)+",(1-alpha)*"+str(chosen_radius)+")", gamma_correction=False) if disk_id is not None: layer.select_id(disk_id) layer.merge_over() layer.set_registry("overlay-color", overlay_color) stroke_initial_color = overlay_color stroke_done = image.do_end() apply_opacity()
def apply_blur(): global blur_done, offset_done if offset_done: image.undo() offset_done = False if blur_done: image.undo() blur_done = False image.do_begin() filters.blur(radius=chosen_radius) blur_done = image.do_end() apply_offset()
def apply_blur(): global blur_done, opacity_done if opacity_done: image.undo() opacity_done = False if blur_done: image.undo() blur_done = False image.do_begin() if chosen_radius == 0: filters.filter_function(alpha=0, gamma_correction=False) else: layer.duplicate() layer.set_opacity(255) filters.filter_function(red="alpha", green="alpha", blue="alpha", alpha=1, gamma_correction=False) mask_layer_id = layer.get_id() layer.select_id(shadow_layer_id) filters.filter_function(red=overlay_color.red / 255, green=overlay_color.green / 255, blue=overlay_color.blue / 255, gamma_correction=False) tools.choose(tools.MOVE_LAYER) offset = (math.sin(chosen_angle * math.pi / 180) * chosen_radius, -math.cos(chosen_angle * math.pi / 180) * chosen_radius) tools.mouse([(0, 0), (offset[0], offset[1])]) layer.select_id(mask_layer_id) layer.duplicate() mask_layer_id2 = layer.get_id() layer.select_id(mask_layer_id) tools.choose(tools.MOVE_LAYER) tools.mouse([(offset[0] / 2, offset[1] / 2), (0, 0)]) colors.linear_negative() layer.set_blend_op(layer.BLEND_MASK) layer.merge_over() mask_layer_id = mask_layer_id2 filters.blur(radius=chosen_radius) layer.select_id(mask_layer_id) layer.set_blend_op(layer.BLEND_MASK) layer.merge_over() blur_done = image.do_end() apply_opacity()