Revert "lv_canvas: comment update"

This reverts commit 078bc96b77.
This commit is contained in:
Gabor Kiss-Vamosi
2019-01-31 20:24:40 +01:00
parent 6770e1ab32
commit 0819688f50
2 changed files with 20 additions and 19 deletions

View File

@@ -221,7 +221,8 @@ void lv_canvas_mult_buf(lv_obj_t * canvas, void * to_copy, lv_coord_t w, lv_coor
* @param w width of the canvas * @param w width of the canvas
* @param h height of the canvas * @param h height of the canvas
* @param cf color format. The following formats are supported: * @param cf color format. The following formats are supported:
* LV_IMG_CF_TRUE_COLOR, LV_IMG_CF_TRUE_COLOR_ALPHA, LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED, LV_IMG_CF_INDEXED_1/2/4/8BIT * LV_IMG_CF_TRUE_COLOR, LV_IMG_CF_TRUE_COLOR_ALPHA, LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED
*
*/ */
void lv_canvas_set_buffer(lv_obj_t * canvas, void * buf, lv_coord_t w, lv_coord_t h, lv_img_cf_t cf) void lv_canvas_set_buffer(lv_obj_t * canvas, void * buf, lv_coord_t w, lv_coord_t h, lv_img_cf_t cf)
{ {
@@ -326,6 +327,8 @@ void lv_canvas_draw_circle(lv_obj_t * canvas, lv_coord_t x0, lv_coord_t y0, lv_c
* @param point1 start point of the line * @param point1 start point of the line
* @param point2 end point of the line * @param point2 end point of the line
* @param color color of the line * @param color color of the line
*
* NOTE: The lv_canvas_draw_line function originates from https://github.com/jb55/bresenham-line.c.
*/ */
/* /*
* NOTE: The lv_canvas_draw_line function originates from https://github.com/jb55/bresenham-line.c. * NOTE: The lv_canvas_draw_line function originates from https://github.com/jb55/bresenham-line.c.
@@ -344,7 +347,6 @@ void lv_canvas_draw_line(lv_obj_t * canvas, lv_point_t point1, lv_point_t point2
int err = (dx>dy ? dx : -dy)/2, e2; int err = (dx>dy ? dx : -dy)/2, e2;
for(;;){ for(;;){
// setPixel(x0,y0);
lv_canvas_set_px(canvas, x0, y0, color); lv_canvas_set_px(canvas, x0, y0, color);
if (x0==x1 && y0==y1) break; if (x0==x1 && y0==y1) break;
@@ -399,10 +401,10 @@ void lv_canvas_draw_polygon(lv_obj_t * canvas, lv_point_t * points, size_t size,
* @param canvas pointer to a canvas object * @param canvas pointer to a canvas object
* @param points edge points of the polygon * @param points edge points of the polygon
* @param size edge count of the polygon * @param size edge count of the polygon
* @param color line color of the polygon * @param boundary_color line color of the polygon
* @param bg_color background color of the polygon * @param fill_color fill color of the polygon
*/ */
void lv_canvas_fill_polygon(lv_obj_t * canvas, lv_point_t * points, size_t size, lv_color_t color, lv_color_t bg_color) void lv_canvas_fill_polygon(lv_obj_t * canvas, lv_point_t * points, size_t size, lv_color_t boundary_color, lv_color_t fill_color)
{ {
uint32_t x = 0, y = 0; uint32_t x = 0, y = 0;
uint8_t i; uint8_t i;
@@ -415,8 +417,7 @@ void lv_canvas_fill_polygon(lv_obj_t * canvas, lv_point_t * points, size_t size,
x = x / size; x = x / size;
y = y / size; y = y / size;
// lv_canvas_flood_fill(canvas, (lv_coord_t) x, (lv_coord_t) y, color, bg_color); lv_canvas_boundary_fill4(canvas, (lv_coord_t) x, (lv_coord_t) y, boundary_color, fill_color);
lv_canvas_boundary_fill4(canvas, (lv_coord_t) x, (lv_coord_t) y, color, color);
} }
/** /**
@@ -424,10 +425,10 @@ void lv_canvas_fill_polygon(lv_obj_t * canvas, lv_point_t * points, size_t size,
* @param canvas pointer to a canvas object * @param canvas pointer to a canvas object
* @param x x coordinate of the start position (seed) * @param x x coordinate of the start position (seed)
* @param y y coordinate of the start position (seed) * @param y y coordinate of the start position (seed)
* @param fill_color fill color of the area
* @param boundary_color edge/boundary color of the area * @param boundary_color edge/boundary color of the area
* @param fill_color fill color of the area
*/ */
void lv_canvas_boundary_fill4(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_color_t fill_color, lv_color_t boundary_color) void lv_canvas_boundary_fill4(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_color_t boundary_color, lv_color_t fill_color)
{ {
lv_color_t c; lv_color_t c;
@@ -436,13 +437,12 @@ void lv_canvas_boundary_fill4(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_
if(c.full != boundary_color.full && if(c.full != boundary_color.full &&
c.full != fill_color.full) c.full != fill_color.full)
{ {
// putpixel(x, y, fill_color);
lv_canvas_set_px(canvas, x, y, fill_color); lv_canvas_set_px(canvas, x, y, fill_color);
lv_canvas_boundary_fill4(canvas, x + 1, y, fill_color, boundary_color); lv_canvas_boundary_fill4(canvas, x + 1, y, boundary_color, fill_color);
lv_canvas_boundary_fill4(canvas, x, y + 1, fill_color, boundary_color); lv_canvas_boundary_fill4(canvas, x, y + 1, boundary_color, fill_color);
lv_canvas_boundary_fill4(canvas, x - 1, y, fill_color, boundary_color); lv_canvas_boundary_fill4(canvas, x - 1, y, boundary_color, fill_color);
lv_canvas_boundary_fill4(canvas, x, y - 1, fill_color, boundary_color); lv_canvas_boundary_fill4(canvas, x, y - 1, boundary_color, fill_color);
} }
} }

View File

@@ -108,16 +108,17 @@ void lv_canvas_mult_buf(lv_obj_t * canvas, void * to_copy, lv_coord_t w, lv_coor
/** /**
* Set a buffer for the canvas. * Set a buffer for the canvas.
* @param buf a buffer where the content of the canvas will be. * @param buf a buffer where the contant of the canvas will be.
* The required size is (lv_img_color_format_get_px_size(cf) * w * h) / 8) * The required size is (lv_img_color_format_get_px_size(cf) * w * h) / 8)
* It can be allocated with `lv_mem_alloc()` or * It can be allocated with `lv_mem_alloc()` or
* it can be statically allocated array (e.g. static lv_color_t buf[100*50]) or * it can be statically allocated array (e.g. static lv_color_t buf[100*50]) or
* it can be an address in RAM or external SRAM * it can be an address in RAM or external SRAM
* @param canvas pointer to a canvas object * @param canvas pointer to a canvas obejct
* @param w width of the canvas * @param w width of the canvas
* @param h height of the canvas * @param h hight of the canvas
* @param cf color format. The following formats are supported: * @param cf color format. The following formats are supported:
* LV_IMG_CF_TRUE_COLOR, LV_IMG_CF_TRUE_COLOR_ALPHA, LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED, LV_IMG_CF_INDEXED_1/2/4/8BIT * LV_IMG_CF_TRUE_COLOR, LV_IMG_CF_TRUE_COLOR_ALPHA, LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED
*
*/ */
void lv_canvas_set_buffer(lv_obj_t * canvas, void * buf, lv_coord_t w, lv_coord_t h, lv_img_cf_t cf); void lv_canvas_set_buffer(lv_obj_t * canvas, void * buf, lv_coord_t w, lv_coord_t h, lv_img_cf_t cf);