Code

Prevent localized doubles from being written into filter matrices
[inkscape.git] / src / sp-paint-server.h
1 #ifndef SEEN_SP_PAINT_SERVER_H
2 #define SEEN_SP_PAINT_SERVER_H
4 /*
5  * Base class for gradients and patterns
6  *
7  * Author:
8  *   Lauris Kaplinski <lauris@kaplinski.com>
9  *   Jon A. Cruz <jon@joncruz.org>
10  *
11  * Copyright (C) 1999-2002 Lauris Kaplinski
12  * Copyright (C) 2000-2001 Ximian, Inc.
13  * Copyright (C) 2010 Authors
14  *
15  * Released under GNU GPL, read the file 'COPYING' for more information
16  */
18 #include <libnr/nr-pixblock.h>
19 #include "sp-object.h"
20 #include "uri-references.h"
22 class SPPainter;
24 #define SP_TYPE_PAINT_SERVER (SPPaintServer::getType())
25 #define SP_PAINT_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_PAINT_SERVER, SPPaintServer))
26 #define SP_PAINT_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_PAINT_SERVER, SPPaintServerClass))
27 #define SP_IS_PAINT_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_PAINT_SERVER))
28 #define SP_IS_PAINT_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_PAINT_SERVER))
30 typedef enum {
31     SP_PAINTER_IND,
32     SP_PAINTER_DEP
33 } SPPainterType;
35 typedef void (* SPPainterFillFunc) (SPPainter *painter, NRPixBlock *pb);
37 /* fixme: I do not like that class thingie (Lauris) */
38 struct SPPainter {
39     SPPainter *next;
40     SPPaintServer *server;
41     GType server_type;
42     SPPainterType type;
43     SPPainterFillFunc fill;
44 };
46 struct SPPaintServer : public SPObject {
47     /** List of paints */
48     SPPainter *painters;
50 protected:
51     bool swatch;
52 public:
54     static GType getType(void);
56     bool isSwatch() const;
57     bool isSolid() const;
59 private:
60     static void init(SPPaintServer *ps);
61 };
63 struct SPPaintServerClass {
64     SPObjectClass sp_object_class;
65     /** Get SPPaint instance. */
66     SPPainter * (* painter_new) (SPPaintServer *ps, Geom::Matrix const &full_transform, Geom::Matrix const &parent_transform, const NRRect *bbox);
67     /** Free SPPaint instance. */
68     void (* painter_free) (SPPaintServer *ps, SPPainter *painter);
69 };
71 SPPainter *sp_paint_server_painter_new (SPPaintServer *ps, Geom::Matrix const &full_transform, Geom::Matrix const &parent_transform, const NRRect *bbox);
73 SPPainter *sp_painter_free (SPPainter *painter);
75 class SPPaintServerReference : public Inkscape::URIReference {
76 public:
77     SPPaintServerReference (SPObject *obj) : URIReference(obj) {}
78     SPPaintServerReference (SPDocument *doc) : URIReference(doc) {}
79     SPPaintServer *getObject() const {
80         return static_cast<SPPaintServer *>(URIReference::getObject());
81     }
82 protected:
83     virtual bool _acceptObject(SPObject *obj) const {
84         return SP_IS_PAINT_SERVER (obj);
85     }
86 };
88 #endif // SEEN_SP_PAINT_SERVER_H
89 /*
90   Local Variables:
91   mode:c++
92   c-file-style:"stroustrup"
93   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
94   indent-tabs-mode:nil
95   fill-column:99
96   End:
97 */
98 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :