Beispiel #1
0
void Shape2D::add_rounded_line(const Pointf &start, const Pointf &end, float line_width, float cap_rounding, bool reverse)
{
	float distance = start.distance(end);
	Sizef size(distance, line_width);

	Angle angle(start.angle_line(end));

	Pointf center(start.x + size.width / 2.0f,  start.y + size.height / 2.0f );
	Vec2f rotated = start;
	rotated.rotate(center, angle);

	Vec2f origin( start.x + (start.x - rotated.x), start.y + (start.y - rotated.y));
	rotated = Vec2f(0.0f, line_width/2.0f);
	rotated.rotate(Vec2f(), angle);
	origin.x -= rotated.x;
	origin.y -= rotated.y;

	add_rounded_rect(origin, size, cap_rounding, angle, reverse);
}