1 // SPDX-License-Identifier: GPL-2.0-or-later 2 #ifndef SEEN_SP_DESKTOP_STYLE_H 3 #define SEEN_SP_DESKTOP_STYLE_H 4 5 /* 6 * Desktop style management 7 * 8 * Authors: 9 * bulia byak 10 * verbalshadow 11 * 12 * Copyright (C) 2004, 2006 authors 13 * 14 * Released under GNU GPL v2+, read the file 'COPYING' for more information. 15 */ 16 17 #include <vector> 18 19 #include <glib.h> 20 21 class ColorRGBA; 22 class SPCSSAttr; 23 class SPDesktop; 24 class SPObject; 25 class SPItem; 26 class SPStyle; 27 namespace Inkscape { 28 class ObjectSet; 29 namespace XML { 30 class Node; 31 } 32 } 33 namespace Glib { class ustring; } 34 35 enum { // what kind of a style the query is returning 36 QUERY_STYLE_NOTHING, // nothing was queried - e.g. no selection 37 QUERY_STYLE_SINGLE, // single object was queried 38 QUERY_STYLE_MULTIPLE_SAME, // multiple objects were queried, the results were the same 39 QUERY_STYLE_MULTIPLE_DIFFERENT, // multiple objects were queried, the results could NOT be meaningfully averaged 40 QUERY_STYLE_MULTIPLE_AVERAGED // multiple objects were queried, the results were meaningfully averaged 41 }; 42 43 enum { // which property was queried (add when you need more) 44 QUERY_STYLE_PROPERTY_EVERYTHING, 45 QUERY_STYLE_PROPERTY_FILL, // fill, fill-opacity 46 QUERY_STYLE_PROPERTY_STROKE, // stroke, stroke-opacity 47 QUERY_STYLE_PROPERTY_STROKEWIDTH, // stroke-width 48 QUERY_STYLE_PROPERTY_STROKEMITERLIMIT, // miter limit 49 QUERY_STYLE_PROPERTY_STROKEJOIN, // stroke join 50 QUERY_STYLE_PROPERTY_STROKECAP, // stroke cap 51 QUERY_STYLE_PROPERTY_STROKESTYLE, // markers, dasharray, miterlimit, stroke-width, stroke-cap, stroke-join 52 QUERY_STYLE_PROPERTY_PAINTORDER, // paint-order 53 QUERY_STYLE_PROPERTY_FONT_SPECIFICATION, //-inkscape-font-specification 54 QUERY_STYLE_PROPERTY_FONTFAMILY, // font-family 55 QUERY_STYLE_PROPERTY_FONTSTYLE, // font style 56 QUERY_STYLE_PROPERTY_FONTVARIANTS, // font variants (OpenType features) 57 QUERY_STYLE_PROPERTY_FONTFEATURESETTINGS, // font feature settings (OpenType features) 58 QUERY_STYLE_PROPERTY_FONTNUMBERS, // size, spacings 59 QUERY_STYLE_PROPERTY_BASELINES, // baseline-shift 60 QUERY_STYLE_PROPERTY_WRITINGMODES, // writing-mode, text-orientation 61 QUERY_STYLE_PROPERTY_MASTEROPACITY, // opacity 62 QUERY_STYLE_PROPERTY_ISOLATION, // isolation 63 QUERY_STYLE_PROPERTY_BLEND, // blend 64 QUERY_STYLE_PROPERTY_BLUR // blur 65 }; 66 67 void sp_desktop_apply_css_recursive(SPObject *o, SPCSSAttr *css, bool skip_lines); 68 void sp_desktop_set_color(SPDesktop *desktop, ColorRGBA const &color, bool is_relative, bool fill); 69 void sp_desktop_set_style(Inkscape::ObjectSet *set, SPDesktop *desktop, SPCSSAttr *css, bool change = true, bool write_current = true); 70 void sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change = true, bool write_current = true); 71 SPCSSAttr *sp_desktop_get_style(SPDesktop *desktop, bool with_text); 72 guint32 sp_desktop_get_color (SPDesktop *desktop, bool is_fill); 73 double sp_desktop_get_master_opacity_tool(SPDesktop *desktop, Glib::ustring const &tool, bool* has_opacity = nullptr); 74 double sp_desktop_get_opacity_tool(SPDesktop *desktop, Glib::ustring const &tool, bool is_fill); 75 guint32 sp_desktop_get_color_tool(SPDesktop *desktop, Glib::ustring const &tool, bool is_fill, bool* has_color = nullptr); 76 double sp_desktop_get_font_size_tool (SPDesktop *desktop); 77 void sp_desktop_apply_style_tool(SPDesktop *desktop, Inkscape::XML::Node *repr, Glib::ustring const &tool, bool with_text); 78 79 gdouble stroke_average_width (const std::vector<SPItem*> &objects); 80 81 int objects_query_fillstroke (const std::vector<SPItem*> &objects, SPStyle *style_res, bool const isfill); 82 int objects_query_fontnumbers (const std::vector<SPItem*> &objects, SPStyle *style_res); 83 int objects_query_fontstyle (const std::vector<SPItem*> &objects, SPStyle *style_res); 84 int objects_query_fontfamily (const std::vector<SPItem*> &objects, SPStyle *style_res); 85 int objects_query_fontvariants (const std::vector<SPItem*> &objects, SPStyle *style_res); 86 int objects_query_opacity (const std::vector<SPItem*> &objects, SPStyle *style_res); 87 int objects_query_strokewidth (const std::vector<SPItem*> &objects, SPStyle *style_res); 88 int objects_query_miterlimit (const std::vector<SPItem*> &objects, SPStyle *style_res); 89 int objects_query_strokecap (const std::vector<SPItem*> &objects, SPStyle *style_res); 90 int objects_query_strokejoin (const std::vector<SPItem*> &objects, SPStyle *style_res); 91 92 int objects_query_blur (const std::vector<SPItem*> &objects, SPStyle *style_res); 93 int objects_query_blend (const std::vector<SPItem*> &objects, SPStyle *style_res); 94 95 int sp_desktop_query_style_from_list (const std::vector<SPItem*> &list, SPStyle *style, int property); 96 int sp_desktop_query_style(SPDesktop *desktop, SPStyle *style, int property); 97 bool sp_desktop_query_style_all (SPDesktop *desktop, SPStyle *query); 98 99 #endif // SEEN_SP_DESKTOP_STYLE_H 100 101 102 /* 103 Local Variables: 104 mode:c++ 105 c-file-style:"stroustrup" 106 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) 107 indent-tabs-mode:nil 108 fill-column:99 109 End: 110 */ 111 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : 112