Extend CanvasItem::draw_circle() with filled, width, and antialiased options

Make it possible to draw unfilled circle, like draw_rect(). Antialising is only implemented for unfilled version.
This commit is contained in:
Yaohua Xiong
2023-11-05 12:25:29 +08:00
committed by Rémi Verschelde
parent f91db3dc58
commit 1f2aa17d14
5 changed files with 95 additions and 5 deletions

View File

@@ -77,8 +77,14 @@
<param index="0" name="position" type="Vector2" />
<param index="1" name="radius" type="float" />
<param index="2" name="color" type="Color" />
<param index="3" name="filled" type="bool" default="true" />
<param index="4" name="width" type="float" default="-1.0" />
<param index="5" name="antialiased" type="bool" default="false" />
<description>
Draws a colored, filled circle. See also [method draw_arc], [method draw_polyline] and [method draw_polygon].
Draws a circle. See also [method draw_arc], [method draw_polyline], and [method draw_polygon].
If [param filled] is [code]true[/code], the circle will be filled with the [param color] specified. If [param filled] is [code]false[/code], the circle will be drawn as a stroke with the [param color] and [param width] specified.
If [param width] is negative, then two-point primitives will be drawn instead of a four-point ones. This means that when the CanvasItem is scaled, the lines will remain thin. If this behavior is not desired, then pass a positive [param width] like [code]1.0[/code].
[b]Note:[/b] [param width] is only effective if [param filled] is [code]false[/code].
</description>
</method>
<method name="draw_colored_polygon">