2013-04-15 22:10:18 -04:00
|
|
|
/*
|
2019-08-03 04:40:09 +02:00
|
|
|
* Copyright (C) 2012 Carl Hetherington <carl@carlh.net>
|
|
|
|
|
* Copyright (C) 2013-2014 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
|
* Copyright (C) 2015-2017 Robin Gareus <robin@gareus.org>
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
*/
|
2013-04-15 22:10:18 -04:00
|
|
|
|
2013-04-04 00:32:52 -04:00
|
|
|
#ifndef __CANVAS_FILL_H__
|
|
|
|
|
#define __CANVAS_FILL_H__
|
|
|
|
|
|
2013-04-16 23:46:22 -04:00
|
|
|
#include <vector>
|
2013-04-04 00:32:52 -04:00
|
|
|
#include <stdint.h>
|
2013-12-27 16:24:58 -05:00
|
|
|
|
2014-06-12 14:53:44 -04:00
|
|
|
#include <boost/noncopyable.hpp>
|
|
|
|
|
|
2013-12-27 16:24:58 -05:00
|
|
|
#include "canvas/visibility.h"
|
2014-06-12 14:53:44 -04:00
|
|
|
#include "canvas/types.h"
|
2013-04-04 00:32:52 -04:00
|
|
|
|
|
|
|
|
namespace ArdourCanvas {
|
|
|
|
|
|
2014-06-12 14:53:44 -04:00
|
|
|
class Item;
|
|
|
|
|
|
|
|
|
|
class LIBCANVAS_API Fill : public boost::noncopyable
|
2013-04-04 00:32:52 -04:00
|
|
|
{
|
|
|
|
|
public:
|
2014-06-12 14:53:44 -04:00
|
|
|
Fill (Item& self);
|
|
|
|
|
virtual ~Fill() {}
|
2013-04-04 00:32:52 -04:00
|
|
|
|
2017-07-17 18:34:35 +02:00
|
|
|
virtual void set_fill_color (Gtkmm2ext::Color);
|
2013-04-16 20:38:10 -04:00
|
|
|
virtual void set_fill (bool);
|
|
|
|
|
|
2017-07-17 18:34:35 +02:00
|
|
|
Gtkmm2ext::Color fill_color () const {
|
2013-04-04 00:32:52 -04:00
|
|
|
return _fill_color;
|
|
|
|
|
}
|
2013-04-16 20:38:10 -04:00
|
|
|
|
2013-04-04 00:32:52 -04:00
|
|
|
bool fill () const {
|
|
|
|
|
return _fill;
|
|
|
|
|
}
|
2013-04-16 23:46:22 -04:00
|
|
|
|
2017-07-17 18:34:35 +02:00
|
|
|
typedef std::vector<std::pair<double,Gtkmm2ext::Color> > StopList;
|
2015-10-05 16:17:49 +02:00
|
|
|
|
2017-07-17 18:34:35 +02:00
|
|
|
void set_gradient (StopList const & stops, bool is_vertical);
|
2013-04-16 23:46:22 -04:00
|
|
|
|
2017-07-17 18:34:35 +02:00
|
|
|
void set_pattern (Cairo::RefPtr<Cairo::Pattern>);
|
2014-09-19 16:21:19 -04:00
|
|
|
|
2013-04-04 00:32:52 -04:00
|
|
|
protected:
|
|
|
|
|
void setup_fill_context (Cairo::RefPtr<Cairo::Context>) const;
|
2017-07-17 18:34:35 +02:00
|
|
|
void setup_gradient_context (Cairo::RefPtr<Cairo::Context>, Rect const &, Duple const &) const;
|
2014-06-12 14:53:44 -04:00
|
|
|
|
2017-07-17 18:34:35 +02:00
|
|
|
Item& _self;
|
|
|
|
|
Gtkmm2ext::Color _fill_color;
|
2013-04-04 00:32:52 -04:00
|
|
|
bool _fill;
|
2014-03-07 12:28:52 -05:00
|
|
|
bool _transparent;
|
2017-07-17 18:34:35 +02:00
|
|
|
StopList _stops;
|
|
|
|
|
bool _vertical_gradient;
|
|
|
|
|
Cairo::RefPtr<Cairo::Pattern> _pattern;
|
2014-09-19 16:21:19 -04:00
|
|
|
|
2013-04-04 00:32:52 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|