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"
21 class SPPainter;
23 #define SP_TYPE_PAINT_SERVER (sp_paint_server_get_type ())
24 #define SP_PAINT_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_PAINT_SERVER, SPPaintServer))
25 #define SP_PAINT_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_PAINT_SERVER, SPPaintServerClass))
26 #define SP_IS_PAINT_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_PAINT_SERVER))
27 #define SP_IS_PAINT_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_PAINT_SERVER))
29 typedef enum {
30 SP_PAINTER_IND,
31 SP_PAINTER_DEP
32 } SPPainterType;
34 typedef void (* SPPainterFillFunc) (SPPainter *painter, NRPixBlock *pb);
36 /* fixme: I do not like that class thingie (Lauris) */
37 struct SPPainter {
38 SPPainter *next;
39 SPPaintServer *server;
40 GType server_type;
41 SPPainterType type;
42 SPPainterFillFunc fill;
43 };
45 struct SPPaintServer : public SPObject {
46 /* List of paints */
47 SPPainter *painters;
48 };
50 struct SPPaintServerClass {
51 SPObjectClass sp_object_class;
52 /* Get SPPaint instance */
53 SPPainter * (* painter_new) (SPPaintServer *ps, NR::Matrix const &full_transform, NR::Matrix const &parent_transform, const NRRect *bbox);
54 /* Free SPPaint instance */
55 void (* painter_free) (SPPaintServer *ps, SPPainter *painter);
56 };
58 GType sp_paint_server_get_type (void);
60 SPPainter *sp_paint_server_painter_new (SPPaintServer *ps, NR::Matrix const &full_transform, NR::Matrix const &parent_transform, const NRRect *bbox);
62 SPPainter *sp_painter_free (SPPainter *painter);
66 #endif