Graphics draw_dash_dotted_line interface¶
This page explains the Graphics
class draw_dash_dotted_line
method interface.
What interface is this?¶
draw_dash_dotted_line
interface draws the simple straight dash-dotted-line (also called 1-dot chain line or long dashed short dashed line) graphics.
This interface will ignore dot_setting
, dash_setting
, round_dot_setting
, and dash_dot_setting
.
Basic usage¶
draw_dash_dotted_line
interface has basic coordinates arguments of x_start
, y_start
, x_end
and y_end
. That also has dot_size
(the short dash size), dash_size
(the long dash size), and space_size
(the space size between each dash) arguments to determine line style.
import apysc as ap
ap.Stage(
background_color=ap.Color("#333"),
stage_width=250,
stage_height=130,
stage_elem_id="stage",
)
sprite: ap.Sprite = ap.Sprite()
# Set 2-pixel dot size and 6-pixel dash size and draw the line.
sprite.graphics.line_style(color=ap.Color("#0af"), thickness=5)
sprite.graphics.draw_dash_dotted_line(
x_start=50, y_start=50, x_end=200, y_end=50, dot_size=2, dash_size=6, space_size=5
)
# Set 5-pixel dot size and 10-pixel dash size and draw the line.
sprite.graphics.draw_dash_dotted_line(
x_start=50, y_start=80, x_end=200, y_end=80, dot_size=5, dash_size=10, space_size=5
)
ap.save_overall_html(dest_dir_path="graphics_draw_dash_dotted_line_basic_usage/")
draw_dash_dotted_line API¶
Note: the document build script generates and updates this API document section automatically. Maybe this section is duplicated compared with previous sections.
[Interface signature] draw_dash_dotted_line(self, *, x_start: Union[float, apysc._type.number.Number], y_start: Union[float, apysc._type.number.Number], x_end: Union[float, apysc._type.number.Number], y_end: Union[float, apysc._type.number.Number], dot_size: Union[int, apysc._type.int.Int], dash_size: Union[int, apysc._type.int.Int], space_size: Union[int, apysc._type.int.Int], variable_name_suffix: str = '') -> '_line.Line'
[Interface summary]
Draw a dash-dotted (1-dot chain) line vector graphics.
[Parameters]
x_start
: float or NumberLine start x-coordinate.
y_start
: float or NumberLine start y-coordinate.
x_end
: float or NumberLine end x-coordinate.
y_end
: float or NumberLine end y-coordinate.
dot_size
: Int or intDot size.
dash_size
: Int or intDash size.
space_size
: Int or intBlank space size between dots and dashes.
variable_name_suffix
: str, default “”A JavaScript variable name suffix string. This setting is sometimes useful for JavaScript debugging.
[Returns]
line
: LineCreated line graphics instance.
[Examples]
>>> import apysc as ap
>>> stage: ap.Stage = ap.Stage()
>>> sprite: ap.Sprite = ap.Sprite()
>>> sprite.graphics.line_style(color=ap.Color("#fff"), thickness=5)
>>> line: ap.Line = sprite.graphics.draw_dash_dotted_line(
... x_start=50,
... y_start=50,
... x_end=150,
... y_end=50,
... dot_size=2,
... dash_size=5,
... space_size=3,
... )
>>> line.line_color
Color("#ffffff")
>>> line.line_dash_dot_setting.dot_size
Int(2)
>>> line.line_dash_dot_setting.dash_size
Int(5)
>>> line.line_dash_dot_setting.space_size
Int(3)