summaryrefslogtreecommitdiff
path: root/shared-bindings/vectorio
diff options
context:
space:
mode:
authorAnson He <ansonhe1997@gmail.com>2020-07-28 17:03:10 +0800
committerGitHub <noreply@github.com>2020-07-28 17:03:10 +0800
commitc010cc2c414a98caa1aa510497666bf017c792ab (patch)
treedac841881017719bae0654a64cbc52f35cf6977a /shared-bindings/vectorio
parent36ef3476de945071da9c1274e5b4d8bcdcc13d13 (diff)
parentdebbf1028adee2309ed991c90517c50d5eb13bfb (diff)
Merge pull request #1 from adafruit/main
Merged main to fork
Diffstat (limited to 'shared-bindings/vectorio')
-rw-r--r--shared-bindings/vectorio/Circle.c4
-rw-r--r--shared-bindings/vectorio/Polygon.c21
-rw-r--r--shared-bindings/vectorio/Rectangle.c2
-rw-r--r--shared-bindings/vectorio/VectorShape.c8
4 files changed, 10 insertions, 25 deletions
diff --git a/shared-bindings/vectorio/Circle.c b/shared-bindings/vectorio/Circle.c
index 65923fd96..8f0d58d87 100644
--- a/shared-bindings/vectorio/Circle.c
+++ b/shared-bindings/vectorio/Circle.c
@@ -11,7 +11,7 @@
//| class Circle:
//|
-//| def __init__(self, radius: int):
+//| def __init__(self, radius: int) -> None:
//| """Circle is positioned on screen by its center point.
//|
//| :param radius: The radius of the circle in pixels"""
@@ -37,7 +37,7 @@ static mp_obj_t vectorio_circle_make_new(const mp_obj_type_t *type, size_t n_arg
}
-//| radius : int = ...
+//| radius : int
//| """The radius of the circle in pixels."""
//|
STATIC mp_obj_t vectorio_circle_obj_get_radius(mp_obj_t self_in) {
diff --git a/shared-bindings/vectorio/Polygon.c b/shared-bindings/vectorio/Polygon.c
index 3443d9e42..6a72f9124 100644
--- a/shared-bindings/vectorio/Polygon.c
+++ b/shared-bindings/vectorio/Polygon.c
@@ -15,10 +15,8 @@
// #define VECTORIO_POLYGON_DEBUG(...) mp_printf(&mp_plat_print __VA_OPT__(,) __VA_ARGS__)
-//| from typing import List, Tuple
-//|
//| class Polygon:
-//| def __init__(self, points: List[ Tuple[ x, y ], ... ] ):
+//| def __init__(self, points: List[Tuple[int, int]]) -> None:
//| """Represents a closed shape by ordered vertices
//|
//| :param points: Vertices for the polygon"""
@@ -44,25 +42,12 @@ static mp_obj_t vectorio_polygon_make_new(const mp_obj_type_t *type, size_t n_ar
}
-//| points: List[ Tuple[ x, y ], ... ] = ...
+//| points: List[Tuple[int, int]]
//| """Set a new look and shape for this polygon"""
//|
STATIC mp_obj_t vectorio_polygon_obj_get_points(mp_obj_t self_in) {
vectorio_polygon_t *self = MP_OBJ_TO_PTR(self_in);
- mp_obj_t list = mp_obj_new_list(0, NULL);
-
- size_t len = 0;
- mp_obj_t *items;
- mp_obj_list_get(common_hal_vectorio_polygon_get_points(self), &len, &items);
-
- for (size_t i = 0; i < len; i += 2) {
- mp_obj_t tuple[] = { items[i], items[i+1] };
- mp_obj_list_append(
- list,
- mp_obj_new_tuple(2, tuple)
- );
- }
- return list;
+ return common_hal_vectorio_polygon_get_points(self);
}
MP_DEFINE_CONST_FUN_OBJ_1(vectorio_polygon_get_points_obj, vectorio_polygon_obj_get_points);
diff --git a/shared-bindings/vectorio/Rectangle.c b/shared-bindings/vectorio/Rectangle.c
index f04a25c35..9a637f317 100644
--- a/shared-bindings/vectorio/Rectangle.c
+++ b/shared-bindings/vectorio/Rectangle.c
@@ -8,7 +8,7 @@
#include "supervisor/shared/translate.h"
//| class Rectangle:
-//| def __init__(self, width: int, height: int):
+//| def __init__(self, width: int, height: int) -> None:
//| """Represents a rectangle by defining its bounds
//|
//| :param width: The number of pixels wide
diff --git a/shared-bindings/vectorio/VectorShape.c b/shared-bindings/vectorio/VectorShape.c
index c512bcd54..957e9dc08 100644
--- a/shared-bindings/vectorio/VectorShape.c
+++ b/shared-bindings/vectorio/VectorShape.c
@@ -20,7 +20,7 @@
//| class VectorShape:
-//| def __init__(self, shape: vectorio.Polygon, pixel_shader: displayio.Palette, x: int=0, y: int=0):
+//| def __init__(self, shape: Polygon, pixel_shader: displayio.Palette, x: int=0, y: int=0) -> None:
//| """Binds a vector shape to a location and pixel color
//|
//| :param shape: The shape to draw.
@@ -93,7 +93,7 @@ STATIC mp_obj_t vectorio_vector_shape_make_new(const mp_obj_type_t *type, size_t
}
-//| x: int = ...
+//| x: int
//| """X position of the center point of the shape in the parent."""
//|
STATIC mp_obj_t vectorio_vector_shape_obj_get_x(mp_obj_t self_in) {
@@ -119,7 +119,7 @@ const mp_obj_property_t vectorio_vector_shape_x_obj = {
};
-//| y: int = ...
+//| y: int
//| """Y position of the center point of the shape in the parent."""
//|
STATIC mp_obj_t vectorio_vector_shape_obj_get_y(mp_obj_t self_in) {
@@ -145,7 +145,7 @@ const mp_obj_property_t vectorio_vector_shape_y_obj = {
};
-//| pixel_shader: displayio.Palette = ...
+//| pixel_shader: displayio.Palette
//| """The pixel shader of the shape."""
//|
STATIC mp_obj_t vectorio_vector_shape_obj_get_pixel_shader(mp_obj_t self_in) {