diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index df94945848a..0f2c616fd3f 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -44,7 +44,7 @@ - Draws an unfilled arc between the given angles with a uniform [param color] and [param width] and optional antialiasing (supported only for positive [param width]). The larger the value of [param point_count], the smoother the curve. [param center] is defined in local space. See also [method draw_circle]. + Draws an unfilled arc between the given angles with a uniform [param color] and [param width] and optional antialiasing (supported only for positive [param width]). The larger the value of [param point_count], the smoother the curve. [param center] is defined in local space. For elliptical arcs, see [method draw_ellipse_arc]. See also [method draw_circle]. If [param width] is negative, it will be ignored and the arc will be drawn using [constant RenderingServer.PRIMITIVE_LINE_STRIP]. This means that when the CanvasItem is scaled, the arc will remain thin. If this behavior is not desired, then pass a positive [param width] like [code]1.0[/code]. The arc is drawn from [param start_angle] towards the value of [param end_angle] so in clockwise direction if [code]start_angle < end_angle[/code] and counter-clockwise otherwise. Passing the same angles but in reversed order will produce the same arc. If absolute difference of [param start_angle] and [param end_angle] is greater than [constant @GDScript.TAU] radians, then a full circle arc is drawn (i.e. arc will not overlap itself). @@ -83,7 +83,7 @@ - Draws a circle, with [param position] defined in local space. See also [method draw_arc], [method draw_polyline], and [method draw_polygon]. + Draws a circle, with [param position] defined in local space. See also [method draw_ellipse], [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]. If [param antialiased] is [code]true[/code], half transparent "feathers" will be attached to the boundary, making outlines smooth. @@ -118,6 +118,40 @@ [b]Note:[/b] [param antialiased] is only effective if [param width] is greater than [code]0.0[/code]. + + + + + + + + + + + Draws an ellipse with semi-major axis [param major] and semi-minor axis [param minor]. See also [method draw_circle], [method draw_ellipse_arc], [method draw_polyline], and [method draw_polygon]. + If [param filled] is [code]true[/code], the ellipse will be filled with the [param color] specified. If [param filled] is [code]false[/code], the ellipse 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 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]. + If [param antialiased] is [code]true[/code], half transparent "feathers" will be attached to the boundary, making outlines smooth. + [b]Note:[/b] [param width] is only effective if [param filled] is [code]false[/code]. + + + + + + + + + + + + + + + Draws an unfilled elliptical arc between the given angles with a uniform [param color] and [param width] and optional antialiasing (supported only for positive [param width]). The larger the value of [param point_count], the smoother the curve. For circular arcs, see [method draw_arc]. See also [method draw_ellipse]. + If [param width] is negative, it will be ignored and the arc will be drawn using [constant RenderingServer.PRIMITIVE_LINE_STRIP]. This means that when the CanvasItem is scaled, the arc will remain thin. If this behavior is not desired, then pass a positive [param width] like [code]1.0[/code]. + The arc is drawn from [param start_angle] towards the value of [param end_angle] so in clockwise direction if [code]start_angle < end_angle[/code] and counter-clockwise otherwise. Passing the same angles but in reversed order will produce the same arc. If absolute difference of [param start_angle] and [param end_angle] is greater than [constant @GDScript.TAU] radians, then a full ellipse is drawn (i.e. arc will not overlap itself). + + diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml index a652d0a01e2..9d64026c424 100644 --- a/doc/classes/RenderingServer.xml +++ b/doc/classes/RenderingServer.xml @@ -227,6 +227,18 @@ If [param ignore] is [code]true[/code], ignore clipping on items drawn with this canvas item until this is called again with [param ignore] set to [code]false[/code]. + + + + + + + + + + Draws an ellipse with semi-major axis [param major] and semi-minor axis [param minor] on the [CanvasItem] pointed to by the [param item] [RID]. See also [method CanvasItem.draw_ellipse]. + + diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp index aaceb1a3ae0..5794dc8b1e8 100644 --- a/scene/main/canvas_item.cpp +++ b/scene/main/canvas_item.cpp @@ -776,8 +776,10 @@ void CanvasItem::draw_polyline_colors(const Vector &p_points, const Vect RenderingServer::get_singleton()->canvas_item_add_polyline(canvas_item, p_points, p_colors, p_width, p_antialiased); } -void CanvasItem::draw_arc(const Vector2 &p_center, real_t p_radius, real_t p_start_angle, real_t p_end_angle, int p_point_count, const Color &p_color, real_t p_width, bool p_antialiased) { +void CanvasItem::draw_ellipse_arc(const Vector2 &p_center, real_t p_major, real_t p_minor, real_t p_start_angle, real_t p_end_angle, int p_point_count, const Color &p_color, real_t p_width, bool p_antialiased) { ERR_THREAD_GUARD; + ERR_DRAW_GUARD; + Vector points; points.resize(p_point_count); Point2 *points_ptr = points.ptrw(); @@ -786,12 +788,19 @@ void CanvasItem::draw_arc(const Vector2 &p_center, real_t p_radius, real_t p_sta const real_t delta_angle = CLAMP(p_end_angle - p_start_angle, -Math::TAU, Math::TAU); for (int i = 0; i < p_point_count; i++) { real_t theta = (i / (p_point_count - 1.0f)) * delta_angle + p_start_angle; - points_ptr[i] = p_center + Vector2(Math::cos(theta), Math::sin(theta)) * p_radius; + points_ptr[i] = p_center + Vector2(p_major * Math::cos(theta), p_minor * Math::sin(theta)); } draw_polyline(points, p_color, p_width, p_antialiased); } +void CanvasItem::draw_arc(const Vector2 &p_center, real_t p_radius, real_t p_start_angle, real_t p_end_angle, int p_point_count, const Color &p_color, real_t p_width, bool p_antialiased) { + ERR_THREAD_GUARD; + ERR_DRAW_GUARD; + + draw_ellipse_arc(p_center, p_radius, p_radius, p_start_angle, p_end_angle, p_point_count, p_color, p_width, p_antialiased); +} + void CanvasItem::draw_multiline(const Vector &p_points, const Color &p_color, real_t p_width, bool p_antialiased) { ERR_THREAD_GUARD; ERR_DRAW_GUARD; @@ -836,18 +845,18 @@ void CanvasItem::draw_rect(const Rect2 &p_rect, const Color &p_color, bool p_fil } } -void CanvasItem::draw_circle(const Point2 &p_pos, real_t p_radius, const Color &p_color, bool p_filled, real_t p_width, bool p_antialiased) { +void CanvasItem::draw_ellipse(const Point2 &p_pos, real_t p_major, real_t p_minor, const Color &p_color, bool p_filled, real_t p_width, bool p_antialiased) { ERR_THREAD_GUARD; ERR_DRAW_GUARD; if (p_filled) { if (p_width != -1.0) { - WARN_PRINT("The draw_circle() \"width\" argument has no effect when \"filled\" is \"true\"."); + WARN_PRINT("The \"width\" argument has no effect when \"filled\" is \"true\"."); } - RenderingServer::get_singleton()->canvas_item_add_circle(canvas_item, p_pos, p_radius, p_color, p_antialiased); - } else if (p_width >= 2.0 * p_radius) { - RenderingServer::get_singleton()->canvas_item_add_circle(canvas_item, p_pos, p_radius + 0.5 * p_width, p_color, p_antialiased); + RenderingServer::get_singleton()->canvas_item_add_ellipse(canvas_item, p_pos, p_major, p_minor, p_color, p_antialiased); + } else if (p_width >= 2.0 * MAX(p_major, p_minor)) { + RenderingServer::get_singleton()->canvas_item_add_ellipse(canvas_item, p_pos, p_major + 0.5 * p_width, p_minor + 0.5 * p_width, p_color, p_antialiased); } else { // Tessellation count is hardcoded. Keep in sync with the same variable in `RendererCanvasCull::canvas_item_add_circle()`. const int circle_segments = 64; @@ -860,8 +869,8 @@ void CanvasItem::draw_circle(const Point2 &p_pos, real_t p_radius, const Color & for (int i = 0; i < circle_segments; i++) { float angle = i * circle_point_step; - points_ptr[i].x = Math::cos(angle) * p_radius; - points_ptr[i].y = Math::sin(angle) * p_radius; + points_ptr[i].x = Math::cos(angle) * p_major; + points_ptr[i].y = Math::sin(angle) * p_minor; points_ptr[i] += p_pos; } points_ptr[circle_segments] = points_ptr[0]; @@ -872,6 +881,13 @@ void CanvasItem::draw_circle(const Point2 &p_pos, real_t p_radius, const Color & } } +void CanvasItem::draw_circle(const Point2 &p_pos, real_t p_radius, const Color &p_color, bool p_filled, real_t p_width, bool p_antialiased) { + ERR_THREAD_GUARD; + ERR_DRAW_GUARD; + + draw_ellipse(p_pos, p_radius, p_radius, p_color, p_filled, p_width, p_antialiased); +} + void CanvasItem::draw_texture(const Ref &p_texture, const Point2 &p_pos, const Color &p_modulate) { ERR_THREAD_GUARD; ERR_DRAW_GUARD; @@ -1378,11 +1394,13 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("draw_dashed_line", "from", "to", "color", "width", "dash", "aligned", "antialiased"), &CanvasItem::draw_dashed_line, DEFVAL(-1.0), DEFVAL(2.0), DEFVAL(true), DEFVAL(false)); ClassDB::bind_method(D_METHOD("draw_polyline", "points", "color", "width", "antialiased"), &CanvasItem::draw_polyline, DEFVAL(-1.0), DEFVAL(false)); ClassDB::bind_method(D_METHOD("draw_polyline_colors", "points", "colors", "width", "antialiased"), &CanvasItem::draw_polyline_colors, DEFVAL(-1.0), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("draw_ellipse_arc", "center", "major", "minor", "start_angle", "end_angle", "point_count", "color", "width", "antialiased"), &CanvasItem::draw_ellipse_arc, DEFVAL(-1.0), DEFVAL(false)); ClassDB::bind_method(D_METHOD("draw_arc", "center", "radius", "start_angle", "end_angle", "point_count", "color", "width", "antialiased"), &CanvasItem::draw_arc, DEFVAL(-1.0), DEFVAL(false)); ClassDB::bind_method(D_METHOD("draw_multiline", "points", "color", "width", "antialiased"), &CanvasItem::draw_multiline, DEFVAL(-1.0), DEFVAL(false)); ClassDB::bind_method(D_METHOD("draw_multiline_colors", "points", "colors", "width", "antialiased"), &CanvasItem::draw_multiline_colors, DEFVAL(-1.0), DEFVAL(false)); ClassDB::bind_method(D_METHOD("draw_rect", "rect", "color", "filled", "width", "antialiased"), &CanvasItem::draw_rect, DEFVAL(true), DEFVAL(-1.0), DEFVAL(false)); ClassDB::bind_method(D_METHOD("draw_circle", "position", "radius", "color", "filled", "width", "antialiased"), &CanvasItem::draw_circle, DEFVAL(true), DEFVAL(-1.0), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("draw_ellipse", "position", "major", "minor", "color", "filled", "width", "antialiased"), &CanvasItem::draw_ellipse, DEFVAL(true), DEFVAL(-1.0), DEFVAL(false)); ClassDB::bind_method(D_METHOD("draw_texture", "texture", "position", "modulate"), &CanvasItem::draw_texture, DEFVAL(Color(1, 1, 1, 1))); ClassDB::bind_method(D_METHOD("draw_texture_rect", "texture", "rect", "tile", "modulate", "transpose"), &CanvasItem::draw_texture_rect, DEFVAL(Color(1, 1, 1, 1)), DEFVAL(false)); ClassDB::bind_method(D_METHOD("draw_texture_rect_region", "texture", "rect", "src_rect", "modulate", "transpose", "clip_uv"), &CanvasItem::draw_texture_rect_region, DEFVAL(Color(1, 1, 1, 1)), DEFVAL(false), DEFVAL(true)); diff --git a/scene/main/canvas_item.h b/scene/main/canvas_item.h index b66c9c555de..ebd8698452b 100644 --- a/scene/main/canvas_item.h +++ b/scene/main/canvas_item.h @@ -306,10 +306,12 @@ public: void draw_line(const Point2 &p_from, const Point2 &p_to, const Color &p_color, real_t p_width = -1.0, bool p_antialiased = false); void draw_polyline(const Vector &p_points, const Color &p_color, real_t p_width = -1.0, bool p_antialiased = false); void draw_polyline_colors(const Vector &p_points, const Vector &p_colors, real_t p_width = -1.0, bool p_antialiased = false); + void draw_ellipse_arc(const Vector2 &p_center, real_t p_major, real_t p_minor, real_t p_start_angle, real_t p_end_angle, int p_point_count, const Color &p_color, real_t p_width = -1.0, bool p_antialiased = false); void draw_arc(const Vector2 &p_center, real_t p_radius, real_t p_start_angle, real_t p_end_angle, int p_point_count, const Color &p_color, real_t p_width = -1.0, bool p_antialiased = false); void draw_multiline(const Vector &p_points, const Color &p_color, real_t p_width = -1.0, bool p_antialiased = false); void draw_multiline_colors(const Vector &p_points, const Vector &p_colors, real_t p_width = -1.0, bool p_antialiased = false); void draw_rect(const Rect2 &p_rect, const Color &p_color, bool p_filled = true, real_t p_width = -1.0, bool p_antialiased = false); + void draw_ellipse(const Point2 &p_pos, real_t p_major, real_t p_minor, const Color &p_color, bool p_filled = true, real_t p_width = -1.0, bool p_antialiased = false); void draw_circle(const Point2 &p_pos, real_t p_radius, const Color &p_color, bool p_filled = true, real_t p_width = -1.0, bool p_antialiased = false); void draw_texture(const Ref &p_texture, const Point2 &p_pos, const Color &p_modulate = Color(1, 1, 1, 1)); void draw_texture_rect(const Ref &p_texture, const Rect2 &p_rect, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false); diff --git a/servers/rendering/renderer_canvas_cull.cpp b/servers/rendering/renderer_canvas_cull.cpp index 42ba93c0f2e..c7bd1f6a70a 100644 --- a/servers/rendering/renderer_canvas_cull.cpp +++ b/servers/rendering/renderer_canvas_cull.cpp @@ -1429,56 +1429,56 @@ void RendererCanvasCull::canvas_item_add_rect(RID p_item, const Rect2 &p_rect, c } } -void RendererCanvasCull::canvas_item_add_circle(RID p_item, const Point2 &p_pos, float p_radius, const Color &p_color, bool p_antialiased) { +void RendererCanvasCull::canvas_item_add_ellipse(RID p_item, const Point2 &p_pos, float p_major, float p_minor, const Color &p_color, bool p_antialiased) { Item *canvas_item = canvas_item_owner.get_or_null(p_item); ERR_FAIL_NULL(canvas_item); - static const int circle_segments = 64; + static const int ellipse_segments = 64; { - Item::CommandPolygon *circle = canvas_item->alloc_command(); - ERR_FAIL_NULL(circle); + Item::CommandPolygon *ellipse = canvas_item->alloc_command(); + ERR_FAIL_NULL(ellipse); - circle->primitive = RS::PRIMITIVE_TRIANGLES; + ellipse->primitive = RS::PRIMITIVE_TRIANGLES; Vector indices; Vector points; - points.resize(circle_segments + 2); + points.resize(ellipse_segments + 2); Vector2 *points_ptr = points.ptrw(); - // Store circle center in the last point. - points_ptr[circle_segments + 1] = p_pos; + // Store ellipse center in the last point. + points_ptr[ellipse_segments + 1] = p_pos; - const real_t circle_point_step = Math::TAU / circle_segments; + const real_t ellipse_point_step = Math::TAU / ellipse_segments; - for (int i = 0; i < circle_segments + 1; i++) { - float angle = i * circle_point_step; - points_ptr[i].x = Math::cos(angle) * p_radius; - points_ptr[i].y = Math::sin(angle) * p_radius; + for (int i = 0; i < ellipse_segments + 1; i++) { + float angle = i * ellipse_point_step; + points_ptr[i].x = Math::cos(angle) * p_major; + points_ptr[i].y = Math::sin(angle) * p_minor; points_ptr[i] += p_pos; } - indices.resize(circle_segments * 3); + indices.resize(ellipse_segments * 3); int *indices_ptr = indices.ptrw(); - for (int i = 0; i < circle_segments; i++) { - indices_ptr[i * 3 + 0] = circle_segments + 1; + for (int i = 0; i < ellipse_segments; i++) { + indices_ptr[i * 3 + 0] = ellipse_segments + 1; indices_ptr[i * 3 + 1] = i; indices_ptr[i * 3 + 2] = i + 1; } Vector color; color.push_back(p_color); - circle->polygon.create(indices, points, color); + ellipse->polygon.create(indices, points, color); } if (p_antialiased) { float border_size = FEATHER_SIZE; - const float diameter = p_radius * 2.0f; - if (0.0f <= diameter && diameter < 1.0f) { - border_size *= p_radius; + const float max_axis = fmax(p_major, p_minor) * 2.0f; + if (0.0f <= max_axis && max_axis < 1.0f) { + border_size *= max_axis * 0.5f; } Item::CommandPolygon *feather = canvas_item->alloc_command(); @@ -1491,25 +1491,25 @@ void RendererCanvasCull::canvas_item_add_circle(RID p_item, const Point2 &p_pos, Vector colors; Vector points; - points.resize(2 * circle_segments + 2); - colors.resize(2 * circle_segments + 2); + points.resize(2 * ellipse_segments + 2); + colors.resize(2 * ellipse_segments + 2); - const real_t circle_point_step = Math::TAU / circle_segments; + const real_t ellipse_point_step = Math::TAU / ellipse_segments; Vector2 *points_ptr = points.ptrw(); Color *colors_ptr = colors.ptrw(); - for (int i = 0; i < circle_segments + 1; i++) { - const float angle = i * circle_point_step; + for (int i = 0; i < ellipse_segments + 1; i++) { + const float angle = i * ellipse_point_step; const float c = Math::cos(angle); const float s = Math::sin(angle); - points_ptr[i * 2].x = c * p_radius; - points_ptr[i * 2].y = s * p_radius; + points_ptr[i * 2].x = c * p_major; + points_ptr[i * 2].y = s * p_minor; points_ptr[i * 2] += p_pos; - points_ptr[i * 2 + 1].x = c * (p_radius + border_size); - points_ptr[i * 2 + 1].y = s * (p_radius + border_size); + points_ptr[i * 2 + 1].x = c * (p_major + border_size); + points_ptr[i * 2 + 1].y = s * (p_minor + border_size); points_ptr[i * 2 + 1] += p_pos; colors_ptr[i * 2] = p_color; @@ -1520,6 +1520,10 @@ void RendererCanvasCull::canvas_item_add_circle(RID p_item, const Point2 &p_pos, } } +void RendererCanvasCull::canvas_item_add_circle(RID p_item, const Point2 &p_pos, float p_radius, const Color &p_color, bool p_antialiased) { + canvas_item_add_ellipse(p_item, p_pos, p_radius, p_radius, p_color, p_antialiased); +} + void RendererCanvasCull::canvas_item_add_texture_rect(RID p_item, const Rect2 &p_rect, RID p_texture, bool p_tile, const Color &p_modulate, bool p_transpose) { Item *canvas_item = canvas_item_owner.get_or_null(p_item); ERR_FAIL_NULL(canvas_item); diff --git a/servers/rendering/renderer_canvas_cull.h b/servers/rendering/renderer_canvas_cull.h index c83fa1fb66e..e59b9d4d481 100644 --- a/servers/rendering/renderer_canvas_cull.h +++ b/servers/rendering/renderer_canvas_cull.h @@ -259,6 +259,7 @@ public: void canvas_item_add_polyline(RID p_item, const Vector &p_points, const Vector &p_colors, float p_width = -1.0, bool p_antialiased = false); void canvas_item_add_multiline(RID p_item, const Vector &p_points, const Vector &p_colors, float p_width = -1.0, bool p_antialiased = false); void canvas_item_add_rect(RID p_item, const Rect2 &p_rect, const Color &p_color, bool p_antialiased); + void canvas_item_add_ellipse(RID p_item, const Point2 &p_pos, float p_major, float p_minor, const Color &p_color, bool p_antialiased = false); void canvas_item_add_circle(RID p_item, const Point2 &p_pos, float p_radius, const Color &p_color, bool p_antialiased); void canvas_item_add_texture_rect(RID p_item, const Rect2 &p_rect, RID p_texture, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false); void canvas_item_add_texture_rect_region(RID p_item, const Rect2 &p_rect, RID p_texture, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, bool p_clip_uv = false); diff --git a/servers/rendering/rendering_server_default.h b/servers/rendering/rendering_server_default.h index 3c198652b23..19d6a498edf 100644 --- a/servers/rendering/rendering_server_default.h +++ b/servers/rendering/rendering_server_default.h @@ -982,6 +982,7 @@ public: FUNC5(canvas_item_add_polyline, RID, const Vector &, const Vector &, float, bool) FUNC5(canvas_item_add_multiline, RID, const Vector &, const Vector &, float, bool) FUNC4(canvas_item_add_rect, RID, const Rect2 &, const Color &, bool) + FUNC6(canvas_item_add_ellipse, RID, const Point2 &, float, float, const Color &, bool) FUNC5(canvas_item_add_circle, RID, const Point2 &, float, const Color &, bool) FUNC6(canvas_item_add_texture_rect, RID, const Rect2 &, RID, bool, const Color &, bool) FUNC7(canvas_item_add_texture_rect_region, RID, const Rect2 &, RID, const Rect2 &, const Color &, bool, bool) diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp index 8202dff8cbe..a2b7ae4faf9 100644 --- a/servers/rendering_server.cpp +++ b/servers/rendering_server.cpp @@ -3304,6 +3304,7 @@ void RenderingServer::_bind_methods() { ClassDB::bind_method(D_METHOD("canvas_item_add_multiline", "item", "points", "colors", "width", "antialiased"), &RenderingServer::canvas_item_add_multiline, DEFVAL(-1.0), DEFVAL(false)); ClassDB::bind_method(D_METHOD("canvas_item_add_rect", "item", "rect", "color", "antialiased"), &RenderingServer::canvas_item_add_rect, DEFVAL(false)); ClassDB::bind_method(D_METHOD("canvas_item_add_circle", "item", "pos", "radius", "color", "antialiased"), &RenderingServer::canvas_item_add_circle, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("canvas_item_add_ellipse", "item", "pos", "major", "minor", "color", "antialiased"), &RenderingServer::canvas_item_add_ellipse, DEFVAL(false)); ClassDB::bind_method(D_METHOD("canvas_item_add_texture_rect", "item", "rect", "texture", "tile", "modulate", "transpose"), &RenderingServer::canvas_item_add_texture_rect, DEFVAL(false), DEFVAL(Color(1, 1, 1)), DEFVAL(false)); ClassDB::bind_method(D_METHOD("canvas_item_add_msdf_texture_rect_region", "item", "rect", "texture", "src_rect", "modulate", "outline_size", "px_range", "scale"), &RenderingServer::canvas_item_add_msdf_texture_rect_region, DEFVAL(Color(1, 1, 1)), DEFVAL(0), DEFVAL(1.0), DEFVAL(1.0)); ClassDB::bind_method(D_METHOD("canvas_item_add_lcd_texture_rect_region", "item", "rect", "texture", "src_rect", "modulate"), &RenderingServer::canvas_item_add_lcd_texture_rect_region); diff --git a/servers/rendering_server.h b/servers/rendering_server.h index a5a62b9653f..1639f9cb74c 100644 --- a/servers/rendering_server.h +++ b/servers/rendering_server.h @@ -1579,6 +1579,7 @@ public: virtual void canvas_item_add_polyline(RID p_item, const Vector &p_points, const Vector &p_colors, float p_width = -1.0, bool p_antialiased = false) = 0; virtual void canvas_item_add_multiline(RID p_item, const Vector &p_points, const Vector &p_colors, float p_width = -1.0, bool p_antialiased = false) = 0; virtual void canvas_item_add_rect(RID p_item, const Rect2 &p_rect, const Color &p_color, bool p_antialiased = false) = 0; + virtual void canvas_item_add_ellipse(RID p_item, const Point2 &p_pos, float p_major, float p_minor, const Color &p_color, bool p_antialiased = false) = 0; virtual void canvas_item_add_circle(RID p_item, const Point2 &p_pos, float p_radius, const Color &p_color, bool p_antialiased = false) = 0; virtual void canvas_item_add_texture_rect(RID p_item, const Rect2 &p_rect, RID p_texture, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false) = 0; virtual void canvas_item_add_texture_rect_region(RID p_item, const Rect2 &p_rect, RID p_texture, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, bool p_clip_uv = false) = 0;