use super::color::Rgba;
use super::{Draw, DrawIface, DrawImpl, DrawSharedImpl, PassId};
use crate::geom::{Quad, Vec2};
pub trait DrawRounded: Draw {
fn rounded_line(&mut self, p1: Vec2, p2: Vec2, radius: f32, col: Rgba);
fn circle(&mut self, rect: Quad, inner_radius: f32, col: Rgba);
fn circle_2col(&mut self, rect: Quad, col1: Rgba, col2: Rgba);
fn rounded_frame(&mut self, outer: Quad, inner: Quad, inner_radius: f32, col: Rgba);
fn rounded_frame_2col(&mut self, outer: Quad, inner: Quad, c1: Rgba, c2: Rgba);
}
impl<'a, DS: DrawSharedImpl> DrawRounded for DrawIface<'a, DS>
where
DS::Draw: DrawRoundedImpl,
{
#[inline]
fn rounded_line(&mut self, p1: Vec2, p2: Vec2, radius: f32, col: Rgba) {
self.draw.rounded_line(self.pass, p1, p2, radius, col);
}
#[inline]
fn circle(&mut self, rect: Quad, inner_radius: f32, col: Rgba) {
self.draw.circle(self.pass, rect, inner_radius, col);
}
#[inline]
fn circle_2col(&mut self, rect: Quad, col1: Rgba, col2: Rgba) {
self.draw.circle_2col(self.pass, rect, col1, col2);
}
#[inline]
fn rounded_frame(&mut self, outer: Quad, inner: Quad, inner_radius: f32, col: Rgba) {
self.draw
.rounded_frame(self.pass, outer, inner, inner_radius, col);
}
#[inline]
fn rounded_frame_2col(&mut self, outer: Quad, inner: Quad, c1: Rgba, c2: Rgba) {
self.draw
.rounded_frame_2col(self.pass, outer, inner, c1, c2);
}
}
pub trait DrawRoundedImpl: DrawImpl {
fn rounded_line(&mut self, pass: PassId, p1: Vec2, p2: Vec2, radius: f32, col: Rgba);
fn circle(&mut self, pass: PassId, rect: Quad, inner_radius: f32, col: Rgba);
fn circle_2col(&mut self, pass: PassId, rect: Quad, col1: Rgba, col2: Rgba);
fn rounded_frame(&mut self, pass: PassId, outer: Quad, inner: Quad, r1: f32, col: Rgba);
fn rounded_frame_2col(&mut self, pass: PassId, outer: Quad, inner: Quad, c1: Rgba, c2: Rgba);
}