summaryrefslogtreecommitdiffstats
path: root/src/display/nr-style.h
blob: ce154cec04f6bb12841ea24650041fcd877f9788 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**
 * @file
 * Style information for rendering.
 *//*
 * Authors:
 *   Krzysztof Kosiński <tweenk.pl@gmail.com>
 *
 * Copyright (C) 2010 Authors
 * Released under GNU GPL, read the file 'COPYING' for more information
 */

#ifndef SEEN_INKSCAPE_DISPLAY_NR_ARENA_STYLE_H
#define SEEN_INKSCAPE_DISPLAY_NR_ARENA_STYLE_H

#include <cairo.h>
#include <2geom/rect.h>
#include "color.h"

class SPColor;
class SPPaintServer;
class SPStyle;
namespace Inkscape {
class DrawingContext;
}

struct NRStyle {
    NRStyle();
    ~NRStyle();

    void set(SPStyle *);
    bool prepareFill(Inkscape::DrawingContext &ct, Geom::OptRect const &paintbox);
    bool prepareStroke(Inkscape::DrawingContext &ct, Geom::OptRect const &paintbox);
    void applyFill(Inkscape::DrawingContext &ct);
    void applyStroke(Inkscape::DrawingContext &ct);
    void update();

    enum PaintType {
        PAINT_NONE,
        PAINT_COLOR,
        PAINT_SERVER
    };

    struct Paint {
        Paint() : type(PAINT_NONE), color(0), server(NULL), opacity(1.0) {}
        ~Paint() { clear(); }

        PaintType type;
        SPColor color;
        SPPaintServer *server;
        float opacity;

        void clear();
        void set(SPColor const &c);
        void set(SPPaintServer *ps);
    };

    Paint fill;
    Paint stroke;
    float stroke_width;
    float miter_limit;
    unsigned int n_dash;
    double *dash;
    float dash_offset;
    cairo_fill_rule_t fill_rule;
    cairo_line_cap_t line_cap;
    cairo_line_join_t line_join;

    cairo_pattern_t *fill_pattern;
    cairo_pattern_t *stroke_pattern;
};

#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:encoding=utf-8:textwidth=99 :