def staff_line(page_prop: PageProperties, staff_prop: StaffProperties, point: Point): x, y = point lines = [] lenght = page_prop.width - point.x - staff_prop.right_offset for i in range(7): dotted_lines = LINE_SET_SETUP line = Polyline( points=[(x, y + i * staff_prop.staff_line_offset ), (x + lenght, y + i * staff_prop.staff_line_offset)]).stroke( color=svgwrite.rgb(0, 0, 0), width=2, linejoin='bevel', ) if dotted_lines[i]: line.dasharray([5, 7]) lines.append(line) return lines
def markup_extra_staffs(staff_prop: StaffProperties, staff_start_position, horizontal_note_position, note_vertical_offset): objects = [] if note_vertical_offset < 0: count = abs(int( (note_vertical_offset) // staff_prop.staff_line_offset)) for idx in range(1, count + 1): y = staff_start_position - idx * staff_prop.staff_line_offset line = Polyline(points=[(horizontal_note_position - 40, y), (horizontal_note_position + 50, y)]).stroke( color=svgwrite.rgb(0, 0, 0), width=2, linejoin='bevel', ) # 7 lines in LINE_SET_SETUP, last - bottom. # Get for next top last with skipping 1 doubled starting and 1 existing. if LINE_SET_SETUP[-((idx) % 3) - 1]: line.dasharray([5, 7]) objects += [line] if note_vertical_offset > staff_prop.staff_height: count = int((note_vertical_offset - staff_prop.staff_height) // staff_prop.staff_line_offset) for idx in range(1, count + 1): y = staff_start_position + staff_prop.staff_height + idx * staff_prop.staff_line_offset line = Polyline(points=[(horizontal_note_position - 40, y), (horizontal_note_position + 50, y)]).stroke( color=svgwrite.rgb(0, 0, 0), width=2, linejoin='bevel', ) # 7 lines in LINE_SET_SETUP, first - top. Get for next bottom from start, skipping 1 existing. if LINE_SET_SETUP[idx % 3]: line.dasharray([5, 7]) objects += [line] return objects