18
18
//| :param int height: The number of pixels high
19
19
//| :param int x: Initial x position of the top left corner.
20
20
//| :param int y: Initial y position of the top left corner.
21
- //| :param int color_number : Initial color_number to use when selecting color from the palette."""
21
+ //| :param int color_index : Initial color_index to use when selecting color from the palette."""
22
22
//|
23
23
static mp_obj_t vectorio_rectangle_make_new (const mp_obj_type_t * type , size_t n_args , size_t n_kw , const mp_obj_t * all_args ) {
24
- enum { ARG_pixel_shader , ARG_width , ARG_height , ARG_x , ARG_y , ARG_color_number };
24
+ enum { ARG_pixel_shader , ARG_width , ARG_height , ARG_x , ARG_y , ARG_color_index };
25
25
static const mp_arg_t allowed_args [] = {
26
26
{ MP_QSTR_pixel_shader , MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED },
27
27
{ MP_QSTR_width , MP_ARG_REQUIRED | MP_ARG_INT },
28
28
{ MP_QSTR_height , MP_ARG_REQUIRED | MP_ARG_INT },
29
29
{ MP_QSTR_x , MP_ARG_INT | MP_ARG_KW_ONLY , {.u_int = 0 } },
30
30
{ MP_QSTR_y , MP_ARG_INT | MP_ARG_KW_ONLY , {.u_int = 0 } },
31
- { MP_QSTR_color_number , MP_ARG_INT | MP_ARG_KW_ONLY , {.u_int = 1 } },
31
+ { MP_QSTR_color_index , MP_ARG_INT | MP_ARG_KW_ONLY , {.u_int = 0 } },
32
32
};
33
33
mp_arg_val_t args [MP_ARRAY_SIZE (allowed_args )];
34
34
mp_arg_parse_all_kw_array (n_args , n_kw , all_args , MP_ARRAY_SIZE (allowed_args ), allowed_args , args );
@@ -44,8 +44,8 @@ static mp_obj_t vectorio_rectangle_make_new(const mp_obj_type_t *type, size_t n_
44
44
45
45
vectorio_rectangle_t * self = m_new_obj (vectorio_rectangle_t );
46
46
self -> base .type = & vectorio_rectangle_type ;
47
- int32_t color_number = args [ARG_color_number ].u_int ;
48
- common_hal_vectorio_rectangle_construct (self , width , height , color_number );
47
+ uint16_t color_index = args [ARG_color_index ].u_int ;
48
+ common_hal_vectorio_rectangle_construct (self , width , height , color_index );
49
49
50
50
// VectorShape parts
51
51
mp_obj_t pixel_shader = args [ARG_pixel_shader ].u_obj ;
@@ -109,26 +109,26 @@ const mp_obj_property_t vectorio_rectangle_height_obj = {
109
109
MP_ROM_NONE },
110
110
};
111
111
112
- //| color_number : int
113
- //| """The color_number of the rectangle in 1 based index of the palette."""
112
+ //| color_index : int
113
+ //| """The color_index of the rectangle in 1 based index of the palette."""
114
114
//|
115
- STATIC mp_obj_t vectorio_rectangle_obj_get_color_number (mp_obj_t self_in ) {
115
+ STATIC mp_obj_t vectorio_rectangle_obj_get_color_index (mp_obj_t self_in ) {
116
116
vectorio_rectangle_t * self = MP_OBJ_TO_PTR (self_in );
117
- return mp_obj_new_int (common_hal_vectorio_rectangle_get_color_number (self ));
117
+ return mp_obj_new_int (common_hal_vectorio_rectangle_get_color_index (self ));
118
118
}
119
- MP_DEFINE_CONST_FUN_OBJ_1 (vectorio_rectangle_get_color_number_obj , vectorio_rectangle_obj_get_color_number );
119
+ MP_DEFINE_CONST_FUN_OBJ_1 (vectorio_rectangle_get_color_index_obj , vectorio_rectangle_obj_get_color_index );
120
120
121
- STATIC mp_obj_t vectorio_rectangle_obj_set_color_number (mp_obj_t self_in , mp_obj_t color_number ) {
121
+ STATIC mp_obj_t vectorio_rectangle_obj_set_color_index (mp_obj_t self_in , mp_obj_t color_index ) {
122
122
vectorio_rectangle_t * self = MP_OBJ_TO_PTR (self_in );
123
- common_hal_vectorio_rectangle_set_color_number (self , mp_obj_get_int (color_number ));
123
+ common_hal_vectorio_rectangle_set_color_index (self , mp_obj_get_int (color_index ));
124
124
return mp_const_none ;
125
125
}
126
- MP_DEFINE_CONST_FUN_OBJ_2 (vectorio_rectangle_set_color_number_obj , vectorio_rectangle_obj_set_color_number );
126
+ MP_DEFINE_CONST_FUN_OBJ_2 (vectorio_rectangle_set_color_index_obj , vectorio_rectangle_obj_set_color_index );
127
127
128
- const mp_obj_property_t vectorio_rectangle_color_number_obj = {
128
+ const mp_obj_property_t vectorio_rectangle_color_index_obj = {
129
129
.base .type = & mp_type_property ,
130
- .proxy = {(mp_obj_t )& vectorio_rectangle_get_color_number_obj ,
131
- (mp_obj_t )& vectorio_rectangle_set_color_number_obj ,
130
+ .proxy = {(mp_obj_t )& vectorio_rectangle_get_color_index_obj ,
131
+ (mp_obj_t )& vectorio_rectangle_set_color_index_obj ,
132
132
MP_ROM_NONE },
133
133
};
134
134
@@ -153,7 +153,7 @@ STATIC const mp_rom_map_elem_t vectorio_rectangle_locals_dict_table[] = {
153
153
// Properties
154
154
{ MP_ROM_QSTR (MP_QSTR_x ), MP_ROM_PTR (& vectorio_vector_shape_x_obj ) },
155
155
{ MP_ROM_QSTR (MP_QSTR_y ), MP_ROM_PTR (& vectorio_vector_shape_y_obj ) },
156
- { MP_ROM_QSTR (MP_QSTR_color_number ), MP_ROM_PTR (& vectorio_rectangle_color_number_obj ) },
156
+ { MP_ROM_QSTR (MP_QSTR_color_index ), MP_ROM_PTR (& vectorio_rectangle_color_index_obj ) },
157
157
{ MP_ROM_QSTR (MP_QSTR_width ), MP_ROM_PTR (& vectorio_rectangle_width_obj ) },
158
158
{ MP_ROM_QSTR (MP_QSTR_height ), MP_ROM_PTR (& vectorio_rectangle_height_obj ) },
159
159
{ MP_ROM_QSTR (MP_QSTR_location ), MP_ROM_PTR (& vectorio_vector_shape_location_obj ) },
0 commit comments