Add support for rotated gradients
This commit is contained in:
@@ -121,6 +121,20 @@ class PD_API Color {
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lerp
|
||||
* @param v Target color
|
||||
* @param t interpolation factor
|
||||
* @return Class Reference
|
||||
*/
|
||||
constexpr Color& Lerp(const Color& v, float t) {
|
||||
a = static_cast<u8>(a + (v.a - a) * t);
|
||||
b = static_cast<u8>(b + (v.b - b) * t);
|
||||
g = static_cast<u8>(g + (v.g - g) * t);
|
||||
r = static_cast<u8>(r + (v.r - r) * t);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get 32Bit Color Value
|
||||
* @return 32Bit Color Value (ABGR iirc)
|
||||
|
||||
@@ -26,6 +26,7 @@ using LiDrawFlags = PD::u32;
|
||||
enum LiDrawFlags_ : PD::u32 {
|
||||
LiDrawFlags_None = 0,
|
||||
LiDrawFlags_Close = 1 << 0,
|
||||
LiDrawFlags_AA = 1 << 1,
|
||||
};
|
||||
|
||||
namespace PD {
|
||||
@@ -58,6 +59,8 @@ class PD_API Drawlist {
|
||||
void PathStroke(const PD::Color& color, int t = 1,
|
||||
LiDrawFlags flags = LiDrawFlags_None);
|
||||
void PathFill(const PD::Color& color);
|
||||
void PathFillGradient(const PD::Color& a, const PD::Color& b,
|
||||
float rad = 0.f);
|
||||
void PathArcToN(const fvec2& c, float r, float amin, float amax, int s);
|
||||
void PathFastArcToN(const fvec2& c, float r, float amin, float amax, int s);
|
||||
void PathRect(const fvec2& tl, const fvec2& br, float r = 0.f);
|
||||
@@ -97,6 +100,8 @@ class PD_API Drawlist {
|
||||
void DrawPolyLine(const Pool<fvec2>& points, const PD::Color& color,
|
||||
LiDrawFlags flags = LiDrawFlags_None, int t = 1);
|
||||
void DrawConvexPolyFilled(const Pool<fvec2>& points, const PD::Color& color);
|
||||
void DrawConvexPolyFilled(const Pool<fvec2>& points, const PD::Color& a,
|
||||
const PD::Color b, float rad = 0.f);
|
||||
|
||||
void PrimQuad(Command& cmd, const Rect& quad, const Rect& uv,
|
||||
const PD::Color& color);
|
||||
|
||||
Reference in New Issue
Block a user