Drop-shadow spacer; for theming.

This commit is contained in:
Ben Loftis
2018-02-17 22:25:39 -06:00
parent 4c7ad5db4d
commit 0b3026d388
2 changed files with 29 additions and 0 deletions

View File

@@ -25,3 +25,9 @@ ArdourVSpacer::ArdourVSpacer (float r)
, ratio (r)
{
}
ArdourDropShadow::ArdourDropShadow (float a)
: CairoWidget ()
, alpha (a)
{
}

View File

@@ -51,6 +51,29 @@ protected:
float ratio;
};
class LIBWIDGETS_API ArdourDropShadow : public CairoWidget
{
public:
ArdourDropShadow (float a = 0.75f);
protected:
void render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*) {
float width = get_width();
float height = get_height();
Cairo::RefPtr<Cairo::LinearGradient> _gradient = Cairo::LinearGradient::create (0, 0, 0, height);
_gradient->add_color_stop_rgba (0, 0, 0, 0, alpha);
_gradient->add_color_stop_rgba (1, 0, 0, 0, 0);
ctx->set_source (_gradient);
ctx->rectangle (0, 0, width, height);
ctx->fill ();
}
float alpha;
};
} /* end namespace */
#endif