7f18e8ab01ce21c98cc7b9f58ffe5e771ebbb64eLiam P. White#ifndef SEEN_NR_FILTER_SLOT_H
7f18e8ab01ce21c98cc7b9f58ffe5e771ebbb64eLiam P. White#define SEEN_NR_FILTER_SLOT_H
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala/*
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala * A container class for filter slots. Allows for simple getting and
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala * setting images in filter slots without having to bother with
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala * table indexes and such.
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala *
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala * Author:
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala * Niko Kiirala <niko@kiirala.com>
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala *
bc44e67acb1457725817238120bcef0d1f1ada04kiirala * Copyright (C) 2006,2007 Niko Kiirala
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala *
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala * Released under GNU GPL, read the file 'COPYING' for more information
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala */
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński#include <map>
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould#include "display/nr-filter-types.h"
bc44e67acb1457725817238120bcef0d1f1ada04kiirala#include "display/nr-filter-units.h"
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala
7f18e8ab01ce21c98cc7b9f58ffe5e771ebbb64eLiam P. Whiteextern "C" {
7f18e8ab01ce21c98cc7b9f58ffe5e771ebbb64eLiam P. Whitetypedef struct _cairo cairo_t;
7f18e8ab01ce21c98cc7b9f58ffe5e771ebbb64eLiam P. Whitetypedef struct _cairo_surface cairo_surface_t;
7f18e8ab01ce21c98cc7b9f58ffe5e771ebbb64eLiam P. White}
7f18e8ab01ce21c98cc7b9f58ffe5e771ebbb64eLiam P. White
d9a7c806ee7f408ddb61ff4f233c9d96111ee2b5johanengelennamespace Inkscape {
ed422cc32e064690397f1e4aeb526ebda5fbca77Krzysztof Kosińskiclass DrawingContext;
d1bde559850436556ebee2e70e10f1cfc8aff636Krzysztof Kosińskiclass DrawingItem;
ed422cc32e064690397f1e4aeb526ebda5fbca77Krzysztof Kosiński
d9a7c806ee7f408ddb61ff4f233c9d96111ee2b5johanengelennamespace Filters {
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiiralaclass FilterSlot {
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiiralapublic:
74492c140ec4f83d0e713407c63a05c370e70e4aKrzysztof Kosiński /** Creates a new FilterSlot object. */
58ba7163a5ee19414f3357a7c84d93989cb7498cmathog FilterSlot(DrawingItem *item, DrawingContext *bgdc,
ed422cc32e064690397f1e4aeb526ebda5fbca77Krzysztof Kosiński DrawingContext &graphic, FilterUnits const &u);
cfb5fa826062314dac912b3627f932aab8250988kiirala /** Destroys the FilterSlot object and all its contents */
62d835b4bbb0f1f046e30d9b67f8e9517cc6175cjohanengelen virtual ~FilterSlot();
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala
cfb5fa826062314dac912b3627f932aab8250988kiirala /** Returns the pixblock in specified slot.
cfb5fa826062314dac912b3627f932aab8250988kiirala * Parameter 'slot' may be either an positive integer or one of
cfb5fa826062314dac912b3627f932aab8250988kiirala * pre-defined filter slot types: NR_FILTER_SLOT_NOT_SET,
cfb5fa826062314dac912b3627f932aab8250988kiirala * NR_FILTER_SOURCEGRAPHIC, NR_FILTER_SOURCEALPHA,
cfb5fa826062314dac912b3627f932aab8250988kiirala * NR_FILTER_BACKGROUNDIMAGE, NR_FILTER_BACKGROUNDALPHA,
cfb5fa826062314dac912b3627f932aab8250988kiirala * NR_FILTER_FILLPAINT, NR_FILTER_SOURCEPAINT.
cfb5fa826062314dac912b3627f932aab8250988kiirala */
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński cairo_surface_t *getcairo(int slot);
bc44e67acb1457725817238120bcef0d1f1ada04kiirala
cfb5fa826062314dac912b3627f932aab8250988kiirala /** Sets or re-sets the pixblock associated with given slot.
cfb5fa826062314dac912b3627f932aab8250988kiirala * If there was a pixblock already assigned with this slot,
cfb5fa826062314dac912b3627f932aab8250988kiirala * that pixblock is destroyed.
cfb5fa826062314dac912b3627f932aab8250988kiirala */
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński void set(int slot, cairo_surface_t *s);
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński cairo_surface_t *get_result(int slot_nr);
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński
f79bb40cee052ef5a8e147c93e17312a7a660b81tavmjong-free void set_primitive_area(int slot, Geom::Rect &area);
f79bb40cee052ef5a8e147c93e17312a7a660b81tavmjong-free Geom::Rect get_primitive_area(int slot);
f79bb40cee052ef5a8e147c93e17312a7a660b81tavmjong-free
cfb5fa826062314dac912b3627f932aab8250988kiirala /** Returns the number of slots in use. */
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala int get_slot_count();
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala
bc44e67acb1457725817238120bcef0d1f1ada04kiirala /** Sets the unit system to be used for the internal images. */
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński //void set_units(FilterUnits const &units);
bc44e67acb1457725817238120bcef0d1f1ada04kiirala
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould /** Sets the filtering quality. Affects used interpolation methods */
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould void set_quality(FilterQuality const q);
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould
a657cb9a6e1aca06d04f49bd9844e89c91e34f76theAdib /** Sets the gaussian filtering quality. Affects used interpolation methods */
a657cb9a6e1aca06d04f49bd9844e89c91e34f76theAdib void set_blurquality(int const q);
a657cb9a6e1aca06d04f49bd9844e89c91e34f76theAdib
a657cb9a6e1aca06d04f49bd9844e89c91e34f76theAdib /** Gets the gaussian filtering quality. Affects used interpolation methods */
a657cb9a6e1aca06d04f49bd9844e89c91e34f76theAdib int get_blurquality(void);
a657cb9a6e1aca06d04f49bd9844e89c91e34f76theAdib
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński FilterUnits const &get_units() const { return _units; }
5bd488c81c6b0d67689527621b3b60799b708af0Krzysztof Kosiński Geom::Rect get_slot_area() const;
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosińskiprivate:
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński typedef std::map<int, cairo_surface_t *> SlotMap;
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński SlotMap _slots;
f79bb40cee052ef5a8e147c93e17312a7a660b81tavmjong-free
f79bb40cee052ef5a8e147c93e17312a7a660b81tavmjong-free // We need to keep track of the primitive area as this is needed in feTile
f79bb40cee052ef5a8e147c93e17312a7a660b81tavmjong-free typedef std::map<int, Geom::Rect> PrimitiveAreaMap;
f79bb40cee052ef5a8e147c93e17312a7a660b81tavmjong-free PrimitiveAreaMap _primitiveAreas;
f79bb40cee052ef5a8e147c93e17312a7a660b81tavmjong-free
d1bde559850436556ebee2e70e10f1cfc8aff636Krzysztof Kosiński DrawingItem *_item;
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński //Geom::Rect _source_bbox; ///< bounding box of source graphic surface
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński //Geom::Rect _intermediate_bbox; ///< bounding box of intermediate surfaces
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński
5bd488c81c6b0d67689527621b3b60799b708af0Krzysztof Kosiński int _slot_w, _slot_h;
5bd488c81c6b0d67689527621b3b60799b708af0Krzysztof Kosiński double _slot_x, _slot_y;
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński cairo_surface_t *_source_graphic;
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński cairo_t *_background_ct;
ed422cc32e064690397f1e4aeb526ebda5fbca77Krzysztof Kosiński Geom::IntRect _source_graphic_area;
ed422cc32e064690397f1e4aeb526ebda5fbca77Krzysztof Kosiński Geom::IntRect _background_area; ///< needed to extract background
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński FilterUnits const &_units;
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala int _last_out;
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould FilterQuality filterquality;
a657cb9a6e1aca06d04f49bd9844e89c91e34f76theAdib int blurquality;
a657cb9a6e1aca06d04f49bd9844e89c91e34f76theAdib
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński cairo_surface_t *_get_transformed_source_graphic();
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński cairo_surface_t *_get_transformed_background();
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński cairo_surface_t *_get_fill_paint();
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński cairo_surface_t *_get_stroke_paint();
bc44e67acb1457725817238120bcef0d1f1ada04kiirala
4d2111f1991274cf80f89219637fca969697e661Krzysztof Kosiński void _set_internal(int slot, cairo_surface_t *s);
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala};
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala
d9a7c806ee7f408ddb61ff4f233c9d96111ee2b5johanengelen} /* namespace Filters */
d9a7c806ee7f408ddb61ff4f233c9d96111ee2b5johanengelen} /* namespace Inkscape */
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala#endif // __NR_FILTER_SLOT_H__
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala/*
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala Local Variables:
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala mode:c++
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala c-file-style:"stroustrup"
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala indent-tabs-mode:nil
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala fill-column:99
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala End:
26fe967f30c5b0de45897a858d1ae09dff7c0ea7kiirala*/
a4030d5ca449e7e384bc699cd249ee704faaeab0Chris Morgan// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :