1 #ifndef __SP_GRADIENT_CHEMISTRY_H__
2 #define __SP_GRADIENT_CHEMISTRY_H__
4 /*
5 * Various utility methods for gradients
6 *
7 * Author:
8 * Lauris Kaplinski <lauris@kaplinski.com>
9 * bulia byak <buliabyak@users.sf.net>
10 *
11 * Copyright (C) 2001-2002 Lauris Kaplinski
12 * Copyright (C) 2001 Ximian, Inc.
13 *
14 * Released under GNU GPL, read the file 'COPYING' for more information
15 */
17 #include "forward.h"
18 #include "sp-gradient.h"
20 /*
21 * Either normalizes given gradient to vector, or returns fresh normalized
22 * vector - in latter case, original gradient is flattened and stops cleared
23 * No transrefing - i.e. caller shouldn't hold reference to original and
24 * does not get one to new automatically (doc holds ref of every object anyways)
25 */
27 SPGradient *sp_gradient_ensure_vector_normalized (SPGradient *gradient);
30 /*
31 * Sets item fill/stroke to lineargradient with given vector, creating
32 * new private gradient, if needed
33 * gr has to be normalized vector
34 */
36 SPGradient *sp_item_set_gradient (SPItem *item, SPGradient *gr, SPGradientType type, bool is_fill);
38 /*
39 * Get default normalized gradient vector of document, create if there is none
40 */
42 SPGradient *sp_document_default_gradient_vector (SPDocument *document, guint32 color = 0);
43 SPGradient *sp_gradient_vector_for_object (SPDocument *doc, SPDesktop *desktop, SPObject *o, bool is_fill);
45 void sp_object_ensure_fill_gradient_normalized (SPObject *object);
46 void sp_object_ensure_stroke_gradient_normalized (SPObject *object);
48 SPGradient *sp_gradient_convert_to_userspace (SPGradient *gr, SPItem *item, const gchar *property);
49 SPGradient *sp_gradient_reset_to_userspace (SPGradient *gr, SPItem *item);
51 SPGradient *sp_gradient_fork_vector_if_necessary (SPGradient *gr);
53 SPStop* sp_first_stop(SPGradient *gradient);
54 SPStop* sp_last_stop(SPGradient *gradient);
55 SPStop* sp_prev_stop(SPStop *stop, SPGradient *gradient);
56 SPStop* sp_next_stop(SPStop *stop);
58 void sp_gradient_transform_multiply (SPGradient *gradient, NR::Matrix postmul, bool set);
60 void sp_item_gradient_set_coords (SPItem *item, guint point_num, NR::Point p_desk, bool fill_or_stroke, bool write_repr, bool scale);
61 NR::Point sp_item_gradient_get_coords (SPItem *item, guint point_num, bool fill_or_stroke);
62 SPGradient *sp_item_gradient_get_vector (SPItem *item, bool fill_or_stroke);
63 SPGradientSpread sp_item_gradient_get_spread (SPItem *item, bool fill_or_stroke);
65 struct SPCSSAttr;
66 void sp_item_gradient_stop_set_style (SPItem *item, guint point_num, bool fill_or_stroke, SPCSSAttr *stop);
67 guint32 sp_item_gradient_stop_query_style (SPItem *item, guint point_num, bool fill_or_stroke);
68 void sp_item_gradient_edit_stop (SPItem *item, guint point_num, bool fill_or_stroke);
69 void sp_item_gradient_reverse_vector (SPItem *item, bool fill_or_stroke);
71 #endif
73 /*
74 Local Variables:
75 mode:c++
76 c-file-style:"stroustrup"
77 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
78 indent-tabs-mode:nil
79 fill-column:99
80 End:
81 */
82 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :