Drop-shadow spacer; for theming.
authorBen Loftis <ben@harrisonconsoles.com>
Sun, 18 Feb 2018 04:25:39 +0000 (22:25 -0600)
committerBen Loftis <ben@harrisonconsoles.com>
Sun, 18 Feb 2018 04:25:39 +0000 (22:25 -0600)
libs/widgets/ardour_spacer.cc
libs/widgets/widgets/ardour_spacer.h

index 4155a17ee4a823efcd599c9c85d3f484a4f56e50..712792a710f326f1d6ceb81c026e69ffc69c9488 100644 (file)
@@ -25,3 +25,9 @@ ArdourVSpacer::ArdourVSpacer (float r)
        , ratio (r)
 {
 }
+
+ArdourDropShadow::ArdourDropShadow (float a)
+       : CairoWidget ()
+       , alpha (a)
+{
+}
index b2668f19d73306561a835b69ba566225b5995799..e9f6ad144800aacb1eadcb7aa890cbb51e7d34c5 100644 (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