Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Changes
Page history
[~]*-functions.md: update polygon and added iter/map_func()
authored
Apr 15, 2020
by
gibbonjoyeux
Show whitespace changes
Inline
Side-by-side
api/drawing-functions.md
View page @
65ad7455
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
-
[
set_text_align
](
#set_text_align
)
-
[
set_text_align
](
#set_text_align
)
-
[
set_text_wrap
](
#set_text_wrap
)
-
[
set_text_wrap
](
#set_text_wrap
)
-
[
Other
](
#other
)
-
[
Other
](
#other
)
-
[
shape
](
#shape
)
-
[
polygon
](
#polygon
)
-
[
fill
](
#fill
)
-
[
fill
](
#fill
)
-
[
border
](
#border
)
-
[
border
](
#border
)
-
[
set_draw_mode
](
#set_draw_mode
)
-
[
set_draw_mode
](
#set_draw_mode
)
...
@@ -335,41 +335,41 @@ than the text / paragraph width).
...
@@ -335,41 +335,41 @@ than the text / paragraph width).
# Other
# Other
##
shape
##
polygon
```
javascript
```
javascript
>
shape
(
x
,
y
,
r
adius_x
,
radius_
y
,
vertices
,
char
acter
);
>
polygon
(
x
,
y
,
r
x
,
r
y
,
vertices
,
char
_edges
);
>
shape
(
x
,
y
,
r
adius_x
,
radius_
y
,
vertices
,
char
acter
,
linked
);
>
polygon
(
x
,
y
,
r
x
,
r
y
,
vertices
,
char
_edges
,
char_fill
);
>
shape
(
x
,
y
,
r
adius_x
,
radius_
y
,
vertices
,
char
acter
,
linked
,
rotation
_offset
);
>
polygon
(
x
,
y
,
r
x
,
r
y
,
vertices
,
char
_edges
,
char_fill
,
rotation
);
```
```
Draws a shape on the active layer. The shape is positioned at
`x`
and
`y`
passed
Draws a polygon on the active layer. The polygon is positioned at
`x`
and
`y`
coordinates. The value of
`vertices`
defines the number of sides of the shape.
passed coordinates. The value of
`vertices`
defines the number of edges of the
With 3 vertices, the shape would be a
**triangle**
, with 4, a
**square**
etc.
polygon.
The bigger this value is, the nearer the shape would be to a
**circle**
.
With 3 vertices, the polygon would be a
**triangle**
, with 4, a
**square**
etc.
The bigger this value is, the nearer the polygon would be to a
**circle**
.
`r
adius_
x`
and
`r
adius_
y`
are used to modify the
shape
width / height ratio. As
`rx`
and
`ry`
are used to modify the
polygon
width / height ratio. As
most fonts
most fonts
have characters taller than bigger, it is important to make some
have characters taller than bigger, it is important to make some
tests with your
tests with your
font to know which radius would give the
shape
you want.
font to know which radius would give the
polygon
you want.
`character`
is used to draw the shape.
`char_edges`
is the character used to draw the polygon's edges.
`char_fill`
is the character used to fill the polygon. If
`char_fill`
is not
passed or passed as
`null`
, only the edges will be drawn.
If
`linked`
(
`true`
by default) is set to
`false`
, sides of the shape will not
`rotation`
(
`0`
by default) is a number value (between
`0`
and
`1`
) which sets
be drawn. Only the corners will.
the polygon rotation offset between 2 corners. Looping from
`0`
to
`1`
would
make the polygon rotate continually.
`rotation_offset`
(
`0`
by default) is a number value (between
`0`
and
`1`
) which
sets the shape rotation offset between 2 corners. Looping from
`0`
to
`1`
would
make the shape rotate continually.
### Parameters:
### Parameters:
-
`x`
Number: x coordinate of the
shape
center
-
`x`
Number: x coordinate of the
polygon
center
-
`y`
Number: y coordinate of the
shape
center
-
`y`
Number: y coordinate of the
polygon
center
-
`r
adius_
x`
Number: Width of the
shape
-
`rx`
Number: Width of the
polygon
-
`r
adius_
y`
Number: Height of the
shape
-
`ry`
Number: Height of the
polygon
-
`vertices`
Number: Number of vertices of the
shape
-
`vertices`
Number: Number of vertices of the
polygon
-
`char
acter
`
Character
s
(string): Character used to draw the
shape
-
`char
_edges
`
Character (string): Character used to draw the
polygon's edges
-
`
linked`
Boolean: If
`true`
, vertices are drawn. If not, only corners are
-
`
char_fill`
Character (string): Character used to fill the polygon
-
`rotation
_offset
`
Number: Between
`0`
and
`1`
, set the
shape
angle based on the difference between two corners
-
`rotation`
Number: Between
`0`
and
`1`
, set the
polygon
angle based on the difference between two corners
## fill
## fill
...
...
...
...