Code

Make curvature work again by fixing a minor omission
[inkscape.git] / src / sp-paint-server.h
1 #ifndef __SP_PAINT_SERVER_H__
2 #define __SP_PAINT_SERVER_H__
4 /*
5  * Base class for gradients and patterns
6  *
7  * Author:
8  *   Lauris Kaplinski <lauris@kaplinski.com>
9  *
10  * Copyright (C) 1999-2002 Lauris Kaplinski
11  * Copyright (C) 2000-2001 Ximian, Inc.
12  *
13  * Released under GNU GPL, read the file 'COPYING' for more information
14  */
16 #include <libnr/nr-pixblock.h>
17 #include "sp-object.h"
18 #include "uri-references.h"
20 class SPPainter;
22 #define SP_TYPE_PAINT_SERVER (sp_paint_server_get_type ())
23 #define SP_PAINT_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_PAINT_SERVER, SPPaintServer))
24 #define SP_PAINT_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_PAINT_SERVER, SPPaintServerClass))
25 #define SP_IS_PAINT_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_PAINT_SERVER))
26 #define SP_IS_PAINT_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_PAINT_SERVER))
28 typedef enum {
29         SP_PAINTER_IND,
30         SP_PAINTER_DEP
31 } SPPainterType;
33 typedef void (* SPPainterFillFunc) (SPPainter *painter, NRPixBlock *pb);
35 /* fixme: I do not like that class thingie (Lauris) */
36 struct SPPainter {
37         SPPainter *next;
38         SPPaintServer *server;
39         GType server_type;
40         SPPainterType type;
41         SPPainterFillFunc fill;
42 };
44 struct SPPaintServer : public SPObject {
45         /* List of paints */
46         SPPainter *painters;
47 };
49 struct SPPaintServerClass {
50         SPObjectClass sp_object_class;
51         /* Get SPPaint instance */
52         SPPainter * (* painter_new) (SPPaintServer *ps, Geom::Matrix const &full_transform, Geom::Matrix const &parent_transform, const NRRect *bbox);
53         /* Free SPPaint instance */
54         void (* painter_free) (SPPaintServer *ps, SPPainter *painter);
55 };
57 GType sp_paint_server_get_type (void);
59 SPPainter *sp_paint_server_painter_new (SPPaintServer *ps, Geom::Matrix const &full_transform, Geom::Matrix const &parent_transform, const NRRect *bbox);
61 SPPainter *sp_painter_free (SPPainter *painter);
63 class SPPaintServerReference : public Inkscape::URIReference {
64 public:
65         SPPaintServerReference (SPObject *obj) : URIReference(obj) {}
66         SPPaintServerReference (SPDocument *doc) : URIReference(doc) {}
67         SPPaintServer *getObject() const {
68                 return (SPPaintServer *)URIReference::getObject();
69         }
70 protected:
71         virtual bool _acceptObject(SPObject *obj) const {
72                 return SP_IS_PAINT_SERVER (obj);
73         }
74 };
76 #endif