tbapi.api.interfaces.idrawing_context
1from __future__ import annotations 2from typing import TYPE_CHECKING 3from tbapi.common.decorators import tb_interface 4from tbapi.common.converters import to_python_datetime, to_net_datetime 5from datetime import datetime 6from Tickblaze.Scripts.Api.Interfaces import IDrawingContext as _IDrawingContext 7from typing import Any, overload 8from abc import ABC, abstractmethod 9from tbapi.core.enums.line_style import LineStyle 10from Tickblaze.Core.Enums import LineStyle as _LineStyle 11if TYPE_CHECKING: 12 from tbapi.api.interfaces.isize import ISize 13 from tbapi.api.models.font import Font 14 from tbapi.api.interfaces.ipoint import IPoint 15 from tbapi.api.models.color import Color 16 from tbapi.api.models.stroke import Stroke 17 from tbapi.api.models.arrow_info import ArrowInfo 18 19@tb_interface(_IDrawingContext) 20class IDrawingContext(): 21 """Defines a context for rendering graphical elements, including shapes, text, and lines.""" 22 23 @property 24 def render_size(self) -> ISize: 25 """The size of the rendering area.""" 26 from tbapi.api.interfaces.isize import ISize 27 val = self._value.RenderSize 28 return ISize(_existing=val) 29 30 @abstractmethod 31 def measure_text(self, text: str, font: Font) -> ISize: 32 """Measures the dimensions of a given text string using the specified font. The text to measure. The font used for measurement. The size of the rendered text.""" 33 result = self._value.MeasureText(text, font._value) 34 from tbapi.api.interfaces.isize import ISize 35 return ISize(_existing=result) 36 37 @abstractmethod 38 def draw_text(self, origin: IPoint, text: str, color: Color, font: Font = None) -> None: 39 """Draws text at the specified origin point. The location where the text is drawn. The text to draw. The color of the text. The font used for rendering the text.""" 40 result = self._value.DrawText(origin._value, text, color._value, font._value) 41 return result 42 43 @abstractmethod 44 def draw_image(self, origin: IPoint, pixels: list[Color]) -> None: 45 """Draws an image at the specified origin point. The location where the image is drawn. The image pixels. Optional image width. Optional image height.""" 46 result = self._value.DrawImage(origin._value, pixels) 47 return result 48 49 @abstractmethod 50 def draw_ellipse(self, center: IPoint, radius_x: float, radius_y: float, fill_color: Color | None, line_color: Color | None = None, line_thickness: int = 1, line_style: LineStyle = LineStyle.Solid) -> None: 51 """Draws an ellipse with the specified dimensions and styling. The center point of the ellipse. The horizontal radius of the ellipse. The vertical radius of the ellipse. The color used to fill the ellipse. The color of the ellipse's outline. The thickness of the outline. The style of the outline.""" 52 result = self._value.DrawEllipse(center._value, radius_x, radius_y, (None if fill_color is None else fill_color._value), (None if line_color is None else line_color._value), line_thickness, _LineStyle(line_style.value if hasattr(line_style, 'value') else int(line_style))) 53 return result 54 55 @abstractmethod 56 def draw_ellipse_with_stroke(self, center: IPoint, radius_x: float, radius_y: float, fill_color: Color | None, stroke: Stroke) -> None: 57 """Draws an ellipse with the specified dimensions and styling. The center point of the ellipse. The horizontal radius of the ellipse. The vertical radius of the ellipse. The color used to fill the ellipse. The stroke of the outline.""" 58 result = self._value.DrawEllipse(center._value, radius_x, radius_y, (None if fill_color is None else fill_color._value), stroke._value) 59 return result 60 61 @abstractmethod 62 def draw_line(self, point_a: IPoint, point_b: IPoint, color: Color, thickness: int = 1, line_style: LineStyle = LineStyle.Solid) -> None: 63 """Draws a line between two points. The first point of the line. The second point of the line. The color of the line. The thickness of the line. The style of the line.""" 64 result = self._value.DrawLine(point_a._value, point_b._value, color._value, thickness, _LineStyle(line_style.value if hasattr(line_style, 'value') else int(line_style))) 65 return result 66 67 @abstractmethod 68 def draw_line_with_stroke(self, point_a: IPoint, point_b: IPoint, stroke: Stroke) -> None: 69 """Draws a line between two points. The first point of the line. The second point of the line. The stroke of the line.""" 70 result = self._value.DrawLine(point_a._value, point_b._value, stroke._value) 71 return result 72 73 @abstractmethod 74 def draw_ray(self, point_a: IPoint, point_b: IPoint, color: Color, thickness: int = 1, line_style: LineStyle = LineStyle.Solid) -> None: 75 """Draws a ray originating from a point and extending through a second point. The starting point of the ray. A point along the direction of the ray. The color of the ray. The thickness of the ray. The style of the ray.""" 76 result = self._value.DrawRay(point_a._value, point_b._value, color._value, thickness, _LineStyle(line_style.value if hasattr(line_style, 'value') else int(line_style))) 77 return result 78 79 @abstractmethod 80 def draw_ray_with_stroke(self, point_a: IPoint, point_b: IPoint, stroke: Stroke) -> None: 81 """Draws a ray originating from a point and extending through a second point. The starting point of the ray. A point along the direction of the ray. The stroke of the ray.""" 82 result = self._value.DrawRay(point_a._value, point_b._value, stroke._value) 83 return result 84 85 @abstractmethod 86 def draw_extended_line(self, point_a: IPoint, point_b: IPoint, color: Color, thickness: int = 1, line_style: LineStyle = LineStyle.Solid) -> None: 87 """Draws a line extended in both directions beyond its endpoints. The first point on the line. The second point on the line. The color of the line. The thickness of the line. The style of the line.""" 88 result = self._value.DrawExtendedLine(point_a._value, point_b._value, color._value, thickness, _LineStyle(line_style.value if hasattr(line_style, 'value') else int(line_style))) 89 return result 90 91 @abstractmethod 92 def draw_extended_line_with_stroke(self, point_a: IPoint, point_b: IPoint, stroke: Stroke) -> None: 93 """Draws a line extended in both directions beyond its endpoints. The first point on the line. The second point on the line. The stroke of the line.""" 94 result = self._value.DrawExtendedLine(point_a._value, point_b._value, stroke._value) 95 return result 96 97 @abstractmethod 98 def draw_rectangle(self, point_a: IPoint, width: float, height: float, fill_color: Color | None, line_color: Color | None = None, line_thickness: int = 1, line_style: LineStyle = LineStyle.Solid) -> None: 99 """Draws a rectangle at the specified location with the given dimensions and styling. The top-left corner of the rectangle. The width of the rectangle. The height of the rectangle. The color used to fill the rectangle. The color of the rectangle's outline. The thickness of the outline. The style of the outline.""" 100 result = self._value.DrawRectangle(point_a._value, width, height, (None if fill_color is None else fill_color._value), (None if line_color is None else line_color._value), line_thickness, _LineStyle(line_style.value if hasattr(line_style, 'value') else int(line_style))) 101 return result 102 103 @abstractmethod 104 def draw_rectangle_with_stroke(self, point_a: IPoint, width: float, height: float, fill_color: Color | None, stroke: Stroke) -> None: 105 """Draws a rectangle at the specified location with the given dimensions and styling. The top-left corner of the rectangle. The width of the rectangle. The height of the rectangle. The color used to fill the rectangle. The stroke of the outline.""" 106 result = self._value.DrawRectangle(point_a._value, width, height, (None if fill_color is None else fill_color._value), stroke._value) 107 return result 108 109 @abstractmethod 110 def draw_rectangle_from_points(self, point_a: IPoint, point_b: IPoint, fill_color: Color | None, line_color: Color | None = None, line_thickness: int = 1, line_style: LineStyle = LineStyle.Solid) -> None: 111 """Draws a rectangle defined by two points with the given styling. The corner of the rectangle. The opposite corner of the rectangle. The color used to fill the rectangle. The color of the rectangle's outline. The thickness of the outline. The style of the outline.""" 112 result = self._value.DrawRectangle(point_a._value, point_b._value, (None if fill_color is None else fill_color._value), (None if line_color is None else line_color._value), line_thickness, _LineStyle(line_style.value if hasattr(line_style, 'value') else int(line_style))) 113 return result 114 115 @abstractmethod 116 def draw_rectangle_from_points_with_stroke(self, point_a: IPoint, point_b: IPoint, fill_color: Color | None, stroke: Stroke) -> None: 117 """Draws a rectangle defined by two points with the given styling. The corner of the rectangle. The opposite corner of the rectangle. The color used to fill the rectangle. The stroke of the outline.""" 118 result = self._value.DrawRectangle(point_a._value, point_b._value, (None if fill_color is None else fill_color._value), stroke._value) 119 return result 120 121 @abstractmethod 122 def draw_polygon(self, points: list[Any], fill_color: Color | None, line_color: Color | None = None, line_thickness: int = 1, line_style: LineStyle = LineStyle.Solid) -> None: 123 """Draws a polygon defined by a sequence of points. The vertices of the polygon. The color used to fill the polygon. The color of the polygon's outline. The thickness of the outline. The style of the outline.""" 124 result = self._value.DrawPolygon(points, (None if fill_color is None else fill_color._value), (None if line_color is None else line_color._value), line_thickness, _LineStyle(line_style.value if hasattr(line_style, 'value') else int(line_style))) 125 return result 126 127 @abstractmethod 128 def draw_polygon_with_stroke(self, points: list[Any], fill_color: Color | None, stroke: Stroke) -> None: 129 """Draws a polygon defined by a sequence of points. The vertices of the polygon. The color used to fill the polygon. The stroke of the outline.""" 130 result = self._value.DrawPolygon(points, (None if fill_color is None else fill_color._value), stroke._value) 131 return result 132 133 @abstractmethod 134 def draw_arrow(self, arrow_info: ArrowInfo, fill_color: Color | None, stroke: Stroke) -> None: 135 """Draws an arrow The spec of the arrow to draw. The color used to fill the polygon. The stroke of the outline.""" 136 result = self._value.DrawArrow(arrow_info._value, (None if fill_color is None else fill_color._value), stroke._value) 137 return result 138
25@tb_interface(_IDrawingContext) 26class IDrawingContext(): 27 """Defines a context for rendering graphical elements, including shapes, text, and lines.""" 28 29 @property 30 def render_size(self) -> ISize: 31 """The size of the rendering area.""" 32 from tbapi.api.interfaces.isize import ISize 33 val = self._value.RenderSize 34 return ISize(_existing=val) 35 36 @abstractmethod 37 def measure_text(self, text: str, font: Font) -> ISize: 38 """Measures the dimensions of a given text string using the specified font. The text to measure. The font used for measurement. The size of the rendered text.""" 39 result = self._value.MeasureText(text, font._value) 40 from tbapi.api.interfaces.isize import ISize 41 return ISize(_existing=result) 42 43 @abstractmethod 44 def draw_text(self, origin: IPoint, text: str, color: Color, font: Font = None) -> None: 45 """Draws text at the specified origin point. The location where the text is drawn. The text to draw. The color of the text. The font used for rendering the text.""" 46 result = self._value.DrawText(origin._value, text, color._value, font._value) 47 return result 48 49 @abstractmethod 50 def draw_image(self, origin: IPoint, pixels: list[Color]) -> None: 51 """Draws an image at the specified origin point. The location where the image is drawn. The image pixels. Optional image width. Optional image height.""" 52 result = self._value.DrawImage(origin._value, pixels) 53 return result 54 55 @abstractmethod 56 def draw_ellipse(self, center: IPoint, radius_x: float, radius_y: float, fill_color: Color | None, line_color: Color | None = None, line_thickness: int = 1, line_style: LineStyle = LineStyle.Solid) -> None: 57 """Draws an ellipse with the specified dimensions and styling. The center point of the ellipse. The horizontal radius of the ellipse. The vertical radius of the ellipse. The color used to fill the ellipse. The color of the ellipse's outline. The thickness of the outline. The style of the outline.""" 58 result = self._value.DrawEllipse(center._value, radius_x, radius_y, (None if fill_color is None else fill_color._value), (None if line_color is None else line_color._value), line_thickness, _LineStyle(line_style.value if hasattr(line_style, 'value') else int(line_style))) 59 return result 60 61 @abstractmethod 62 def draw_ellipse_with_stroke(self, center: IPoint, radius_x: float, radius_y: float, fill_color: Color | None, stroke: Stroke) -> None: 63 """Draws an ellipse with the specified dimensions and styling. The center point of the ellipse. The horizontal radius of the ellipse. The vertical radius of the ellipse. The color used to fill the ellipse. The stroke of the outline.""" 64 result = self._value.DrawEllipse(center._value, radius_x, radius_y, (None if fill_color is None else fill_color._value), stroke._value) 65 return result 66 67 @abstractmethod 68 def draw_line(self, point_a: IPoint, point_b: IPoint, color: Color, thickness: int = 1, line_style: LineStyle = LineStyle.Solid) -> None: 69 """Draws a line between two points. The first point of the line. The second point of the line. The color of the line. The thickness of the line. The style of the line.""" 70 result = self._value.DrawLine(point_a._value, point_b._value, color._value, thickness, _LineStyle(line_style.value if hasattr(line_style, 'value') else int(line_style))) 71 return result 72 73 @abstractmethod 74 def draw_line_with_stroke(self, point_a: IPoint, point_b: IPoint, stroke: Stroke) -> None: 75 """Draws a line between two points. The first point of the line. The second point of the line. The stroke of the line.""" 76 result = self._value.DrawLine(point_a._value, point_b._value, stroke._value) 77 return result 78 79 @abstractmethod 80 def draw_ray(self, point_a: IPoint, point_b: IPoint, color: Color, thickness: int = 1, line_style: LineStyle = LineStyle.Solid) -> None: 81 """Draws a ray originating from a point and extending through a second point. The starting point of the ray. A point along the direction of the ray. The color of the ray. The thickness of the ray. The style of the ray.""" 82 result = self._value.DrawRay(point_a._value, point_b._value, color._value, thickness, _LineStyle(line_style.value if hasattr(line_style, 'value') else int(line_style))) 83 return result 84 85 @abstractmethod 86 def draw_ray_with_stroke(self, point_a: IPoint, point_b: IPoint, stroke: Stroke) -> None: 87 """Draws a ray originating from a point and extending through a second point. The starting point of the ray. A point along the direction of the ray. The stroke of the ray.""" 88 result = self._value.DrawRay(point_a._value, point_b._value, stroke._value) 89 return result 90 91 @abstractmethod 92 def draw_extended_line(self, point_a: IPoint, point_b: IPoint, color: Color, thickness: int = 1, line_style: LineStyle = LineStyle.Solid) -> None: 93 """Draws a line extended in both directions beyond its endpoints. The first point on the line. The second point on the line. The color of the line. The thickness of the line. The style of the line.""" 94 result = self._value.DrawExtendedLine(point_a._value, point_b._value, color._value, thickness, _LineStyle(line_style.value if hasattr(line_style, 'value') else int(line_style))) 95 return result 96 97 @abstractmethod 98 def draw_extended_line_with_stroke(self, point_a: IPoint, point_b: IPoint, stroke: Stroke) -> None: 99 """Draws a line extended in both directions beyond its endpoints. The first point on the line. The second point on the line. The stroke of the line.""" 100 result = self._value.DrawExtendedLine(point_a._value, point_b._value, stroke._value) 101 return result 102 103 @abstractmethod 104 def draw_rectangle(self, point_a: IPoint, width: float, height: float, fill_color: Color | None, line_color: Color | None = None, line_thickness: int = 1, line_style: LineStyle = LineStyle.Solid) -> None: 105 """Draws a rectangle at the specified location with the given dimensions and styling. The top-left corner of the rectangle. The width of the rectangle. The height of the rectangle. The color used to fill the rectangle. The color of the rectangle's outline. The thickness of the outline. The style of the outline.""" 106 result = self._value.DrawRectangle(point_a._value, width, height, (None if fill_color is None else fill_color._value), (None if line_color is None else line_color._value), line_thickness, _LineStyle(line_style.value if hasattr(line_style, 'value') else int(line_style))) 107 return result 108 109 @abstractmethod 110 def draw_rectangle_with_stroke(self, point_a: IPoint, width: float, height: float, fill_color: Color | None, stroke: Stroke) -> None: 111 """Draws a rectangle at the specified location with the given dimensions and styling. The top-left corner of the rectangle. The width of the rectangle. The height of the rectangle. The color used to fill the rectangle. The stroke of the outline.""" 112 result = self._value.DrawRectangle(point_a._value, width, height, (None if fill_color is None else fill_color._value), stroke._value) 113 return result 114 115 @abstractmethod 116 def draw_rectangle_from_points(self, point_a: IPoint, point_b: IPoint, fill_color: Color | None, line_color: Color | None = None, line_thickness: int = 1, line_style: LineStyle = LineStyle.Solid) -> None: 117 """Draws a rectangle defined by two points with the given styling. The corner of the rectangle. The opposite corner of the rectangle. The color used to fill the rectangle. The color of the rectangle's outline. The thickness of the outline. The style of the outline.""" 118 result = self._value.DrawRectangle(point_a._value, point_b._value, (None if fill_color is None else fill_color._value), (None if line_color is None else line_color._value), line_thickness, _LineStyle(line_style.value if hasattr(line_style, 'value') else int(line_style))) 119 return result 120 121 @abstractmethod 122 def draw_rectangle_from_points_with_stroke(self, point_a: IPoint, point_b: IPoint, fill_color: Color | None, stroke: Stroke) -> None: 123 """Draws a rectangle defined by two points with the given styling. The corner of the rectangle. The opposite corner of the rectangle. The color used to fill the rectangle. The stroke of the outline.""" 124 result = self._value.DrawRectangle(point_a._value, point_b._value, (None if fill_color is None else fill_color._value), stroke._value) 125 return result 126 127 @abstractmethod 128 def draw_polygon(self, points: list[Any], fill_color: Color | None, line_color: Color | None = None, line_thickness: int = 1, line_style: LineStyle = LineStyle.Solid) -> None: 129 """Draws a polygon defined by a sequence of points. The vertices of the polygon. The color used to fill the polygon. The color of the polygon's outline. The thickness of the outline. The style of the outline.""" 130 result = self._value.DrawPolygon(points, (None if fill_color is None else fill_color._value), (None if line_color is None else line_color._value), line_thickness, _LineStyle(line_style.value if hasattr(line_style, 'value') else int(line_style))) 131 return result 132 133 @abstractmethod 134 def draw_polygon_with_stroke(self, points: list[Any], fill_color: Color | None, stroke: Stroke) -> None: 135 """Draws a polygon defined by a sequence of points. The vertices of the polygon. The color used to fill the polygon. The stroke of the outline.""" 136 result = self._value.DrawPolygon(points, (None if fill_color is None else fill_color._value), stroke._value) 137 return result 138 139 @abstractmethod 140 def draw_arrow(self, arrow_info: ArrowInfo, fill_color: Color | None, stroke: Stroke) -> None: 141 """Draws an arrow The spec of the arrow to draw. The color used to fill the polygon. The stroke of the outline.""" 142 result = self._value.DrawArrow(arrow_info._value, (None if fill_color is None else fill_color._value), stroke._value) 143 return result
Defines a context for rendering graphical elements, including shapes, text, and lines.
29 @property 30 def render_size(self) -> ISize: 31 """The size of the rendering area.""" 32 from tbapi.api.interfaces.isize import ISize 33 val = self._value.RenderSize 34 return ISize(_existing=val)
The size of the rendering area.
36 @abstractmethod 37 def measure_text(self, text: str, font: Font) -> ISize: 38 """Measures the dimensions of a given text string using the specified font. The text to measure. The font used for measurement. The size of the rendered text.""" 39 result = self._value.MeasureText(text, font._value) 40 from tbapi.api.interfaces.isize import ISize 41 return ISize(_existing=result)
Measures the dimensions of a given text string using the specified font. The text to measure. The font used for measurement. The size of the rendered text.
43 @abstractmethod 44 def draw_text(self, origin: IPoint, text: str, color: Color, font: Font = None) -> None: 45 """Draws text at the specified origin point. The location where the text is drawn. The text to draw. The color of the text. The font used for rendering the text.""" 46 result = self._value.DrawText(origin._value, text, color._value, font._value) 47 return result
Draws text at the specified origin point. The location where the text is drawn. The text to draw. The color of the text. The font used for rendering the text.
49 @abstractmethod 50 def draw_image(self, origin: IPoint, pixels: list[Color]) -> None: 51 """Draws an image at the specified origin point. The location where the image is drawn. The image pixels. Optional image width. Optional image height.""" 52 result = self._value.DrawImage(origin._value, pixels) 53 return result
Draws an image at the specified origin point. The location where the image is drawn. The image pixels. Optional image width. Optional image height.
55 @abstractmethod 56 def draw_ellipse(self, center: IPoint, radius_x: float, radius_y: float, fill_color: Color | None, line_color: Color | None = None, line_thickness: int = 1, line_style: LineStyle = LineStyle.Solid) -> None: 57 """Draws an ellipse with the specified dimensions and styling. The center point of the ellipse. The horizontal radius of the ellipse. The vertical radius of the ellipse. The color used to fill the ellipse. The color of the ellipse's outline. The thickness of the outline. The style of the outline.""" 58 result = self._value.DrawEllipse(center._value, radius_x, radius_y, (None if fill_color is None else fill_color._value), (None if line_color is None else line_color._value), line_thickness, _LineStyle(line_style.value if hasattr(line_style, 'value') else int(line_style))) 59 return result
Draws an ellipse with the specified dimensions and styling. The center point of the ellipse. The horizontal radius of the ellipse. The vertical radius of the ellipse. The color used to fill the ellipse. The color of the ellipse's outline. The thickness of the outline. The style of the outline.
61 @abstractmethod 62 def draw_ellipse_with_stroke(self, center: IPoint, radius_x: float, radius_y: float, fill_color: Color | None, stroke: Stroke) -> None: 63 """Draws an ellipse with the specified dimensions and styling. The center point of the ellipse. The horizontal radius of the ellipse. The vertical radius of the ellipse. The color used to fill the ellipse. The stroke of the outline.""" 64 result = self._value.DrawEllipse(center._value, radius_x, radius_y, (None if fill_color is None else fill_color._value), stroke._value) 65 return result
Draws an ellipse with the specified dimensions and styling. The center point of the ellipse. The horizontal radius of the ellipse. The vertical radius of the ellipse. The color used to fill the ellipse. The stroke of the outline.
67 @abstractmethod 68 def draw_line(self, point_a: IPoint, point_b: IPoint, color: Color, thickness: int = 1, line_style: LineStyle = LineStyle.Solid) -> None: 69 """Draws a line between two points. The first point of the line. The second point of the line. The color of the line. The thickness of the line. The style of the line.""" 70 result = self._value.DrawLine(point_a._value, point_b._value, color._value, thickness, _LineStyle(line_style.value if hasattr(line_style, 'value') else int(line_style))) 71 return result
Draws a line between two points. The first point of the line. The second point of the line. The color of the line. The thickness of the line. The style of the line.
73 @abstractmethod 74 def draw_line_with_stroke(self, point_a: IPoint, point_b: IPoint, stroke: Stroke) -> None: 75 """Draws a line between two points. The first point of the line. The second point of the line. The stroke of the line.""" 76 result = self._value.DrawLine(point_a._value, point_b._value, stroke._value) 77 return result
Draws a line between two points. The first point of the line. The second point of the line. The stroke of the line.
79 @abstractmethod 80 def draw_ray(self, point_a: IPoint, point_b: IPoint, color: Color, thickness: int = 1, line_style: LineStyle = LineStyle.Solid) -> None: 81 """Draws a ray originating from a point and extending through a second point. The starting point of the ray. A point along the direction of the ray. The color of the ray. The thickness of the ray. The style of the ray.""" 82 result = self._value.DrawRay(point_a._value, point_b._value, color._value, thickness, _LineStyle(line_style.value if hasattr(line_style, 'value') else int(line_style))) 83 return result
Draws a ray originating from a point and extending through a second point. The starting point of the ray. A point along the direction of the ray. The color of the ray. The thickness of the ray. The style of the ray.
85 @abstractmethod 86 def draw_ray_with_stroke(self, point_a: IPoint, point_b: IPoint, stroke: Stroke) -> None: 87 """Draws a ray originating from a point and extending through a second point. The starting point of the ray. A point along the direction of the ray. The stroke of the ray.""" 88 result = self._value.DrawRay(point_a._value, point_b._value, stroke._value) 89 return result
Draws a ray originating from a point and extending through a second point. The starting point of the ray. A point along the direction of the ray. The stroke of the ray.
91 @abstractmethod 92 def draw_extended_line(self, point_a: IPoint, point_b: IPoint, color: Color, thickness: int = 1, line_style: LineStyle = LineStyle.Solid) -> None: 93 """Draws a line extended in both directions beyond its endpoints. The first point on the line. The second point on the line. The color of the line. The thickness of the line. The style of the line.""" 94 result = self._value.DrawExtendedLine(point_a._value, point_b._value, color._value, thickness, _LineStyle(line_style.value if hasattr(line_style, 'value') else int(line_style))) 95 return result
Draws a line extended in both directions beyond its endpoints. The first point on the line. The second point on the line. The color of the line. The thickness of the line. The style of the line.
97 @abstractmethod 98 def draw_extended_line_with_stroke(self, point_a: IPoint, point_b: IPoint, stroke: Stroke) -> None: 99 """Draws a line extended in both directions beyond its endpoints. The first point on the line. The second point on the line. The stroke of the line.""" 100 result = self._value.DrawExtendedLine(point_a._value, point_b._value, stroke._value) 101 return result
Draws a line extended in both directions beyond its endpoints. The first point on the line. The second point on the line. The stroke of the line.
103 @abstractmethod 104 def draw_rectangle(self, point_a: IPoint, width: float, height: float, fill_color: Color | None, line_color: Color | None = None, line_thickness: int = 1, line_style: LineStyle = LineStyle.Solid) -> None: 105 """Draws a rectangle at the specified location with the given dimensions and styling. The top-left corner of the rectangle. The width of the rectangle. The height of the rectangle. The color used to fill the rectangle. The color of the rectangle's outline. The thickness of the outline. The style of the outline.""" 106 result = self._value.DrawRectangle(point_a._value, width, height, (None if fill_color is None else fill_color._value), (None if line_color is None else line_color._value), line_thickness, _LineStyle(line_style.value if hasattr(line_style, 'value') else int(line_style))) 107 return result
Draws a rectangle at the specified location with the given dimensions and styling. The top-left corner of the rectangle. The width of the rectangle. The height of the rectangle. The color used to fill the rectangle. The color of the rectangle's outline. The thickness of the outline. The style of the outline.
109 @abstractmethod 110 def draw_rectangle_with_stroke(self, point_a: IPoint, width: float, height: float, fill_color: Color | None, stroke: Stroke) -> None: 111 """Draws a rectangle at the specified location with the given dimensions and styling. The top-left corner of the rectangle. The width of the rectangle. The height of the rectangle. The color used to fill the rectangle. The stroke of the outline.""" 112 result = self._value.DrawRectangle(point_a._value, width, height, (None if fill_color is None else fill_color._value), stroke._value) 113 return result
Draws a rectangle at the specified location with the given dimensions and styling. The top-left corner of the rectangle. The width of the rectangle. The height of the rectangle. The color used to fill the rectangle. The stroke of the outline.
115 @abstractmethod 116 def draw_rectangle_from_points(self, point_a: IPoint, point_b: IPoint, fill_color: Color | None, line_color: Color | None = None, line_thickness: int = 1, line_style: LineStyle = LineStyle.Solid) -> None: 117 """Draws a rectangle defined by two points with the given styling. The corner of the rectangle. The opposite corner of the rectangle. The color used to fill the rectangle. The color of the rectangle's outline. The thickness of the outline. The style of the outline.""" 118 result = self._value.DrawRectangle(point_a._value, point_b._value, (None if fill_color is None else fill_color._value), (None if line_color is None else line_color._value), line_thickness, _LineStyle(line_style.value if hasattr(line_style, 'value') else int(line_style))) 119 return result
Draws a rectangle defined by two points with the given styling. The corner of the rectangle. The opposite corner of the rectangle. The color used to fill the rectangle. The color of the rectangle's outline. The thickness of the outline. The style of the outline.
121 @abstractmethod 122 def draw_rectangle_from_points_with_stroke(self, point_a: IPoint, point_b: IPoint, fill_color: Color | None, stroke: Stroke) -> None: 123 """Draws a rectangle defined by two points with the given styling. The corner of the rectangle. The opposite corner of the rectangle. The color used to fill the rectangle. The stroke of the outline.""" 124 result = self._value.DrawRectangle(point_a._value, point_b._value, (None if fill_color is None else fill_color._value), stroke._value) 125 return result
Draws a rectangle defined by two points with the given styling. The corner of the rectangle. The opposite corner of the rectangle. The color used to fill the rectangle. The stroke of the outline.
127 @abstractmethod 128 def draw_polygon(self, points: list[Any], fill_color: Color | None, line_color: Color | None = None, line_thickness: int = 1, line_style: LineStyle = LineStyle.Solid) -> None: 129 """Draws a polygon defined by a sequence of points. The vertices of the polygon. The color used to fill the polygon. The color of the polygon's outline. The thickness of the outline. The style of the outline.""" 130 result = self._value.DrawPolygon(points, (None if fill_color is None else fill_color._value), (None if line_color is None else line_color._value), line_thickness, _LineStyle(line_style.value if hasattr(line_style, 'value') else int(line_style))) 131 return result
Draws a polygon defined by a sequence of points. The vertices of the polygon. The color used to fill the polygon. The color of the polygon's outline. The thickness of the outline. The style of the outline.
133 @abstractmethod 134 def draw_polygon_with_stroke(self, points: list[Any], fill_color: Color | None, stroke: Stroke) -> None: 135 """Draws a polygon defined by a sequence of points. The vertices of the polygon. The color used to fill the polygon. The stroke of the outline.""" 136 result = self._value.DrawPolygon(points, (None if fill_color is None else fill_color._value), stroke._value) 137 return result
Draws a polygon defined by a sequence of points. The vertices of the polygon. The color used to fill the polygon. The stroke of the outline.
139 @abstractmethod 140 def draw_arrow(self, arrow_info: ArrowInfo, fill_color: Color | None, stroke: Stroke) -> None: 141 """Draws an arrow The spec of the arrow to draw. The color used to fill the polygon. The stroke of the outline.""" 142 result = self._value.DrawArrow(arrow_info._value, (None if fill_color is None else fill_color._value), stroke._value) 143 return result
Draws an arrow The spec of the arrow to draw. The color used to fill the polygon. The stroke of the outline.