Draw Lines Effect

Copyright 2023 Ethan Christensen

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class bruhanimate.bruheffect.draw_lines_effect.Line(start_point: tuple[int], end_point: tuple[int])[source]

Bases: object

A class representing a line segment.

__init__(start_point: tuple[int], end_point: tuple[int])[source]

Initializes a Line object with the given start and end points.

Parameters:
  • start_point (tuple[int]) – Start point of the line segment as a tuple (x, y).

  • end_point (tuple[int]) – End point of the line segment as a tuple (x, y).

update_points(start_point: tuple[int], end_point: tuple[int])[source]

Updates the points of the line segment with new values.

Parameters:
  • start_point (tuple[int]) – New start point of the line segment as a tuple (x, y).

  • end_point (tuple[int]) – New end point of the line segment as a tuple (x, y).

get_points()[source]

Returns the start and end points of the line segment.

Returns:

The start and end points of the line.

Return type:

tuple[tuple[int], tuple[int]]

class bruhanimate.bruheffect.draw_lines_effect.DrawLinesEffect(buffer: Buffer, background: str, char: str = None, thin: bool = False)[source]

Bases: BaseEffect

__init__(buffer: Buffer, background: str, char: str = None, thin: bool = False)[source]

Initializes the DrawLinesEffect class.

Parameters:
  • buffer (Buffer) – Effect buffer to push updates to.

  • background (str) – Character or string to use as the background.

  • char (str, optional) – Character to use for line drawing. Defaults to None.

  • thin (bool, optional) – Whether or not the line should be thin. Defaults to False.

add_line(start_point: tuple[int], end_point: tuple[int])[source]

Adds a line to the effect.

Parameters:
  • start_point (tuple[int]) – Start point of the line as a tuple (x, y).

  • end_point (tuple[int]) – End point of the line as a tuple (x, y).

render_frame(frame_number: int)[source]

Renders the effect for a given frame number.

Parameters:

frame_number (int) – The current frame number.