Added type hints to pixelbuf
This commit is contained in:
parent
e273b9a11f
commit
41f12a7a6c
@ -152,7 +152,7 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t
|
||||
}
|
||||
}
|
||||
|
||||
//| bpp: Any = ...
|
||||
//| bpp: int = ...
|
||||
//| """The number of bytes per pixel in the buffer (read-only)"""
|
||||
//|
|
||||
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_bpp(mp_obj_t self_in) {
|
||||
@ -168,7 +168,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_bpp_obj = {
|
||||
};
|
||||
|
||||
|
||||
//| brightness: Any = ...
|
||||
//| brightness: float = ...
|
||||
//| """Float value between 0 and 1. Output brightness.
|
||||
//|
|
||||
//| When brightness is less than 1.0, a second buffer will be used to store the color values
|
||||
@ -199,7 +199,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_brightness_obj = {
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
||||
//| auto_write: Any = ...
|
||||
//| auto_write: bool = ...
|
||||
//| """Whether to automatically write the pixels after each update."""
|
||||
//|
|
||||
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_auto_write(mp_obj_t self_in) {
|
||||
@ -221,7 +221,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_auto_write_obj = {
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
||||
//| byteorder: Any = ...
|
||||
//| byteorder: string = ...
|
||||
//| """byteorder string for the buffer (read-only)"""
|
||||
//|
|
||||
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_byteorder(mp_obj_t self_in) {
|
||||
@ -245,7 +245,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
|
||||
}
|
||||
}
|
||||
|
||||
//| def show(self) -> Any:
|
||||
//| def show(self) -> None:
|
||||
//| """Transmits the color data to the pixels so that they are shown. This is done automatically
|
||||
//| when `auto_write` is True."""
|
||||
//| ...
|
||||
@ -257,9 +257,9 @@ STATIC mp_obj_t pixelbuf_pixelbuf_show(mp_obj_t self_in) {
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_show_obj, pixelbuf_pixelbuf_show);
|
||||
|
||||
//| def fill(color: Any) -> Any:
|
||||
//| """Fills the given pixelbuf with the given color."""
|
||||
//| ...
|
||||
//| def fill(color: tuple[int, int, int]) -> None:
|
||||
//| """Fills the given pixelbuf with the given color."""
|
||||
//| ...
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t value) {
|
||||
@ -269,13 +269,13 @@ STATIC mp_obj_t pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t value) {
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_fill_obj, pixelbuf_pixelbuf_fill);
|
||||
|
||||
//| def __getitem__(self, index: Any) -> Any:
|
||||
//| def __getitem__(self, index: int) -> Tuple[int, int, int, Union[int, float]]:
|
||||
//| """Returns the pixel value at the given index as a tuple of (Red, Green, Blue[, White]) values
|
||||
//| between 0 and 255. When in PWM (DotStar) mode, the 4th tuple value is a float of the pixel
|
||||
//| intensity from 0-1.0."""
|
||||
//| ...
|
||||
//|
|
||||
//| def __setitem__(self, index: Any, value: Any) -> Any:
|
||||
//| def __setitem__(self, index: int, value: Union[int, Tuple[int, int, int, Union[int, float]]]) -> PixelBuf:
|
||||
//| """Sets the pixel value at the given index. Value can either be a tuple or integer. Tuples are
|
||||
//| The individual (Red, Green, Blue[, White]) values between 0 and 255. If given an integer, the
|
||||
//| red, green and blue values are packed into the lower three bytes (0xRRGGBB).
|
||||
|
Loading…
Reference in New Issue
Block a user