From cca66b9ec4e494c1d919bff0f71a820d8afab1fa Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:24:48 +0200 Subject: Adding upstream version 1.2.2. Signed-off-by: Daniel Baumann --- src/ui/widget/gradient-image.h | 76 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 src/ui/widget/gradient-image.h (limited to 'src/ui/widget/gradient-image.h') diff --git a/src/ui/widget/gradient-image.h b/src/ui/widget/gradient-image.h new file mode 100644 index 0000000..d583dbe --- /dev/null +++ b/src/ui/widget/gradient-image.h @@ -0,0 +1,76 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +#ifndef SEEN_SP_GRADIENT_IMAGE_H +#define SEEN_SP_GRADIENT_IMAGE_H + +/** + * A simple gradient preview + * + * Author: + * Lauris Kaplinski + * + * Copyright (C) 2001-2002 Lauris Kaplinski + * Copyright (C) 2001 Ximian, Inc. + * + * Released under GNU GPL v2+, read the file 'COPYING' for more information. + */ + +#include +#include + +class SPGradient; +class SPObject; +class SPStop; + +namespace Gdk { + class Pixbuf; +} + +#include + +namespace Inkscape { +namespace UI { +namespace Widget { +class GradientImage : public Gtk::Widget { + private: + SPGradient *_gradient; + + sigc::connection _release_connection; + sigc::connection _modified_connection; + + void gradient_release(SPObject *obj); + void gradient_modified(SPObject *obj, guint flags); + void update(); + void size_request(GtkRequisition *requisition) const; + + protected: + void get_preferred_width_vfunc(int &minimum_width, int &natural_width) const override; + void get_preferred_height_vfunc(int &minimum_height, int &natural_height) const override; + bool on_draw(const Cairo::RefPtr &cr) override; + + public: + GradientImage(SPGradient *gradient); + ~GradientImage() override; + + void set_gradient(SPGradient *gr); +}; + +} // namespace Widget +} // namespace UI +} // namespace Inkscape + +GdkPixbuf *sp_gradient_to_pixbuf (SPGradient *gr, int width, int height); +Glib::RefPtr sp_gradient_to_pixbuf_ref (SPGradient *gr, int width, int height); +Glib::RefPtr sp_gradstop_to_pixbuf_ref (SPStop *gr, int width, int height); + +#endif + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : -- cgit v1.2.3