2022-03-09 20:02:18 +02:00
|
|
|
#include "Painter.hpp"
|
|
|
|
|
|
|
|
namespace Raven {
|
|
|
|
|
|
|
|
void Painter::rounded_rectangle(Box &geometry, double border_radius) {
|
|
|
|
double aspect = 1.0;
|
|
|
|
double radius = border_radius / aspect;
|
|
|
|
double degrees = M_PI / 180.0;
|
|
|
|
double x = geometry.get_x();
|
|
|
|
double y = geometry.get_y();
|
|
|
|
double w = geometry.get_width();
|
|
|
|
double h = geometry.get_height();
|
|
|
|
|
|
|
|
m_cairo->begin_new_sub_path();
|
|
|
|
m_cairo->arc(x + w - radius, y + radius, radius, -90 * degrees, 0 * degrees);
|
|
|
|
m_cairo->arc(x + w - radius, y + h - radius, radius, 0 * degrees, 90 * degrees);
|
|
|
|
m_cairo->arc(x + radius, y + h - radius, radius, 90 * degrees, 180 * degrees);
|
|
|
|
m_cairo->arc(x + radius, y + radius, radius, 180 * degrees, 270 * degrees);
|
|
|
|
m_cairo->close_path();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|