1 // SPDX-License-Identifier: GPL-2.0-or-later 2 #ifndef SEEN_SP_GRADIENT_IMAGE_H 3 #define SEEN_SP_GRADIENT_IMAGE_H 4 5 /** 6 * A simple gradient preview 7 * 8 * Author: 9 * Lauris Kaplinski <lauris@kaplinski.com> 10 * 11 * Copyright (C) 2001-2002 Lauris Kaplinski 12 * Copyright (C) 2001 Ximian, Inc. 13 * 14 * Released under GNU GPL v2+, read the file 'COPYING' for more information. 15 */ 16 17 #include <glibmm/refptr.h> 18 #include <gtkmm/widget.h> 19 20 class SPGradient; 21 class SPObject; 22 class SPStop; 23 24 namespace Gdk { 25 class Pixbuf; 26 } 27 28 #include <sigc++/connection.h> 29 30 namespace Inkscape { 31 namespace UI { 32 namespace Widget { 33 class GradientImage : public Gtk::Widget { 34 private: 35 SPGradient *_gradient; 36 37 sigc::connection _release_connection; 38 sigc::connection _modified_connection; 39 40 void gradient_release(SPObject *obj); 41 void gradient_modified(SPObject *obj, guint flags); 42 void update(); 43 void size_request(GtkRequisition *requisition) const; 44 45 protected: 46 void get_preferred_width_vfunc(int &minimum_width, int &natural_width) const override; 47 void get_preferred_height_vfunc(int &minimum_height, int &natural_height) const override; 48 bool on_draw(const Cairo::RefPtr<Cairo::Context> &cr) override; 49 50 public: 51 GradientImage(SPGradient *gradient); 52 ~GradientImage() override; 53 54 void set_gradient(SPGradient *gr); 55 }; 56 57 } // namespace Widget 58 } // namespace UI 59 } // namespace Inkscape 60 61 GdkPixbuf *sp_gradient_to_pixbuf (SPGradient *gr, int width, int height); 62 Glib::RefPtr<Gdk::Pixbuf> sp_gradient_to_pixbuf_ref (SPGradient *gr, int width, int height); 63 Glib::RefPtr<Gdk::Pixbuf> sp_gradstop_to_pixbuf_ref (SPStop *gr, int width, int height); 64 65 #endif 66 67 /* 68 Local Variables: 69 mode:c++ 70 c-file-style:"stroustrup" 71 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) 72 indent-tabs-mode:nil 73 fill-column:99 74 End: 75 */ 76 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 : 77