sp-pattern.h revision 42bf51258f01d33f730d1926e4fd050bbe5d6df2
1333N/A/** @file
1333N/A * SVG <pattern> implementation
1333N/A *//*
1333N/A * Author:
1333N/A * Lauris Kaplinski <lauris@kaplinski.com>
1333N/A * Abhishek Sharma
1333N/A *
1333N/A * Copyright (C) 2002 Lauris Kaplinski
1333N/A *
1333N/A * Released under GNU GPL, read the file 'COPYING' for more information
1333N/A */
1333N/A
1333N/A#ifndef SEEN_SP_PATTERN_H
1333N/A#define SEEN_SP_PATTERN_H
1333N/A
1333N/A#include <list>
1333N/A#include <stddef.h>
1333N/A#include <glibmm/ustring.h>
1333N/A#include <sigc++/connection.h>
1333N/A
1333N/A#include "svg/svg-length.h"
1333N/A#include "sp-paint-server.h"
1333N/A#include "uri-references.h"
1333N/A#include "viewbox.h"
1333N/A
1333N/Aclass SPPatternReference;
1333N/Aclass SPItem;
1333N/A
1333N/Anamespace Inkscape {
1333N/Anamespace XML {
1333N/A
1333N/Aclass Node;
1333N/A
1333N/A}
1333N/A}
1333N/A
1333N/A#define SP_PATTERN(obj) (dynamic_cast<SPPattern*>((SPObject*)obj))
1333N/A#define SP_IS_PATTERN(obj) (dynamic_cast<const SPPattern*>((SPObject*)obj) != NULL)
1333N/A
1333N/Aclass SPPattern : public SPPaintServer, public SPViewBox {
1333N/Apublic:
1333N/A enum PatternUnits {
1333N/A UNITS_USERSPACEONUSE,
1333N/A UNITS_OBJECTBOUNDINGBOX
1333N/A };
1333N/A
1333N/A SPPattern();
1333N/A virtual ~SPPattern();
1333N/A
1333N/A /* Reference (href) */
1333N/A Glib::ustring href;
1333N/A SPPatternReference *ref;
1333N/A
1333N/A /* patternUnits and patternContentUnits attribute */
1333N/A PatternUnits patternUnits : 1;
1333N/A bool patternUnits_set : 1;
1333N/A PatternUnits patternContentUnits : 1;
1333N/A bool patternContentUnits_set : 1;
1333N/A /* patternTransform attribute */
1333N/A Geom::Affine patternTransform;
1333N/A bool patternTransform_set : 1;
1333N/A /* Tile rectangle */
1333N/A SVGLength x;
1333N/A SVGLength y;
1333N/A SVGLength width;
1333N/A SVGLength height;
1333N/A
1333N/A sigc::connection modified_connection;
1333N/A
1333N/A bool isValid() const;
1333N/A
1333N/A gdouble get_x() const;
1333N/A gdouble get_y() const;
1333N/A gdouble get_width() const;
1333N/A gdouble get_height() const;
1333N/A Geom::OptRect get_viewbox() const;
1333N/A SPPattern::PatternUnits get_pattern_units() const;
1333N/A SPPattern::PatternUnits get_pattern_content_units() const;
1333N/A Geom::Affine const &get_transform() const;
1333N/A SPPattern *get_root(); //TODO: const
1333N/A
1333N/A SPPattern *clone_if_necessary(SPItem *item, const gchar *property);
1333N/A void transform_multiply(Geom::Affine postmul, bool set);
1333N/A
1333N/A virtual cairo_pattern_t* pattern_new(cairo_t *ct, Geom::OptRect const &bbox, double opacity);
1333N/A
1333N/Aprotected:
1333N/A virtual void build(SPDocument* doc, Inkscape::XML::Node* repr);
1333N/A virtual void release();
1333N/A virtual void set(unsigned int key, const gchar* value);
1333N/A virtual void update(SPCtx* ctx, unsigned int flags);
1333N/A virtual void modified(unsigned int flags);
1333N/A
1333N/Aprivate:
1333N/A bool _has_item_children() const;
1333N/A SPPattern *_chain() const;
1333N/A
1333N/A /**
1333N/A Count how many times pat is used by the styles of o and its descendants
1333N/A */
1333N/A guint _count_hrefs(SPObject* o) const;
1333N/A};
1333N/A
1333N/A
1333N/Aclass SPPatternReference : public Inkscape::URIReference {
1333N/Apublic:
1333N/A SPPatternReference (SPObject *obj) : URIReference(obj) {}
1333N/A SPPattern *getObject() const {
1333N/A return reinterpret_cast<SPPattern *>(URIReference::getObject());
1333N/A }
1333N/A
1333N/Aprotected:
1333N/A virtual bool _acceptObject(SPObject *obj) const {
1333N/A return SP_IS_PATTERN (obj);
1333N/A }
1333N/A};
1333N/A
1333N/A
1333N/Aconst gchar *pattern_tile (const std::list<Inkscape::XML::Node*> &reprs, Geom::Rect bounds, SPDocument *document, Geom::Affine transform, Geom::Affine move);
1333N/A
1333N/A
1333N/A#endif // SEEN_SP_PATTERN_H
1333N/A
1333N/A/*
1333N/A Local Variables:
1333N/A mode:c++
1333N/A c-file-style:"stroustrup"
1333N/A c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
1333N/A indent-tabs-mode:nil
1333N/A fill-column:99
1333N/A End:
1333N/A*/
1333N/A// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
1333N/A