plutovg icon indicating copy to clipboard operation
plutovg copied to clipboard

maybe an error is found in drawing shapes with hole ?

Open THZthz opened this issue 2 years ago • 0 comments

image

for (int x = 0; x < 10; x++) {
    for (int y = 0; y < 10; y++) {
        float rx = 10 + x * 40, ry = 10 + y * 40;
	plutovg_round_rect(pluto, rx, ry, 35, 35, 10, 10);
	plutovg_arc(pluto, rx + 10, ry + 10, 6, 0, M_PI_2, 1);
	plutovg_set_source_rgb(pluto, 1, 192 / 255, 0);
    }
}
plutovg_fill(pluto);

I want to draw round-rect with circle hole in it, but the code aboved turned out be wrong. But when I use API just includes plutovg_move_to and plutovg_line_to to draw rect with rect hole, it turned out to be right.

for (int x = 0; x < 10; x++) {
	for (int y = 0; y < 10; y++) {
		float rx = 10 + x * 40, ry = 10 + y * 40;
		plutovg_rect(pluto, rx, ry, 35, 35);
		plutovg_move_to(pluto, rx + 10, ry + 10);
		plutovg_line_to(pluto, rx + 10, ry + 10 + 20);
		plutovg_line_to(pluto, rx + 10 + 20, ry + 10 + 20);
		plutovg_line_to(pluto, rx + 10 + 20, ry + 10);
		plutovg_close_path(pluto);
		plutovg_set_source_rgb(pluto, 1, 192 / 255, 0);
	}
}
plutovg_fill(pluto);

image

THZthz avatar Apr 23 '22 10:04 THZthz