Papyrus::Shape inherits the concepts of spatial placement and meaningful affine transforms from its parent Papyrus::Drawable, and extends it with the concept of stroking and filling. More...
#include <shape.h>
Public Member Functions | |
PAPYRUS_RENDERABLE (Shape) | |
virtual | ~Shape () |
Destructor. | |
virtual void | set (const AttributeValueMap &avmap) |
virtual void | draw (Context &cairo) const |
Implement Drawable's virtual draw method that takes care of filling and stroking the shape when the fill and/or stroke patterns are present. | |
virtual void | draw_shape (Context &cairo) const =0 |
Children should provide their own implementations of this pure virtual method. | |
virtual void | draw_stroke_path (Context &cairo) const |
The default implementation calls upon draw_shape() to create the path, but a child should provide their own implementation if the draw_shape() is not sufficient for stroking. | |
Fill::pointer | fill () |
The pattern that will be used to fill this shape. | |
void | set_fill (Fill::pointer fill) |
Sets the pattern that will be used to fill this shape. | |
void | set_fill (Paint::pointer paint) |
Creates a new Fill object for the paint and replaces the current fill with the new fill object. | |
void | set_fill (Cairo::RefPtr< Cairo::Pattern > pattern) |
Creates a new Fill object for the pattern and replaces the current fill with the new fill object. | |
void | set_fill (const RGBA &color) |
Creates a new Fill object for the color and replaces the current fill with the new fill object. | |
void | set_fill (const Glib::ustring &fill) |
Creates a new Fill object for the color and replaces the current fill with the new fill object. | |
void | set_fill_paint (const Glib::ustring &paint_name) |
Sets only the fill paint (not other fill characteristics) to the named paint. | |
Stroke::pointer | stroke () |
The Stroke that will be used to draw the stroke. | |
void | set_stroke (Stroke::pointer stroke) |
Sets the stroke style that will be used to stroke this shape. | |
void | set_stroke (Paint::pointer paint) |
Creates a new Stroke object for the paint and replaces the current stroke with the new stroke object. | |
void | set_stroke (Cairo::RefPtr< Cairo::Pattern > pattern) |
Creates a new Stroke object for the pattern and replaces the current stroke with the new stroke object. | |
void | set_stroke (const RGBA &color) |
Creates a new Stroke object for the pattern and replaces the current stroke with the new stroke object. | |
void | set_stroke (const Glib::ustring &stroke) |
Creates a new Stroke object for the pattern and replaces the current stroke with the new stroke object. | |
void | set_stroke_paint (const Glib::ustring &paint_name) |
Sets only the stroke paint (not other stroke characteristics) to the named paint. | |
void | operator= (const Shape &other) |
Protected Member Functions | |
Shape (const Glib::ustring &id=Glib::ustring(), Fill::pointer fill=Fill::pointer(), Stroke::pointer stroke=Stroke::pointer()) | |
Constructor that accepts a fill and stroke. | |
virtual void | on_fill_changed () |
virtual void | on_stroke_changed () |
virtual void | shape_changed (unsigned which=FILL|STROKE) |
Glib::ustring | svg_fill () |
Protected Attributes | |
Fill::pointer | m_fill |
The fill and stroke patterns for this shape. | |
Stroke::pointer | m_stroke |
Cairo::Path * | m_fill_path |
Cairo::Path * | m_stroke_path |
sigc::connection | m_fill_changed_connection |
sigc::connection | m_stroke_changed_connection |
Papyrus::Shape inherits the concepts of spatial placement and meaningful affine transforms from its parent Papyrus::Drawable, and extends it with the concept of stroking and filling.
When inheriting from Papyrus::Shape you should provide a child specific implementation of the draw_shape() method (and not the draw() method from Papyrus::Drawable). This method should use cairo methods to draw the structure of your shape that will be filled with the pattern set by calling the set_fill() method.
In most cases, providing a child specific implementation of the draw_shape() method will be sufficient. However, if your child needs specific methods to perform outlining you should also override the stroke() method.
Papyrus::Shape::Shape | ( | const Glib::ustring & | id = Glib::ustring() , |
|
Fill::pointer | fill = Fill::pointer() , |
|||
Stroke::pointer | stroke = Stroke::pointer() | |||
) | [protected] |
Constructor that accepts a fill and stroke.
References m_fill, m_fill_changed_connection, m_stroke, m_stroke_changed_connection, on_fill_changed(), and on_stroke_changed().
Papyrus::Shape::~Shape | ( | ) | [virtual] |
Destructor.
References m_fill_path, and m_stroke_path.
void Papyrus::Shape::draw | ( | Context & | cairo | ) | const [virtual] |
Implement Drawable's virtual draw method that takes care of filling and stroking the shape when the fill and/or stroke patterns are present.
Implements Papyrus::Drawable.
Reimplemented in Papyrus::Bezierline, and Papyrus::Polyline.
References draw_shape(), draw_stroke_path(), Papyrus::Context::fill(), fill(), m_fill, m_fill_path, Papyrus::Drawable::m_parent, m_stroke, m_stroke_path, Papyrus::Context::stroke(), and stroke().
virtual void Papyrus::Shape::draw_shape | ( | Context & | cairo | ) | const [pure virtual] |
Children should provide their own implementations of this pure virtual method.
A child should create the necessary path that will be filled by the draw() method.
Implemented in Papyrus::Annulus, Papyrus::Arc, Papyrus::Beziergon, Papyrus::Bezierline, Papyrus::Circle, Papyrus::Marker, Papyrus::Path, Papyrus::Polygon, Papyrus::Polyline, Papyrus::Rectangle, and Papyrus::Text.
Referenced by draw(), and draw_stroke_path().
void Papyrus::Shape::draw_stroke_path | ( | Context & | cairo | ) | const [virtual] |
The default implementation calls upon draw_shape() to create the path, but a child should provide their own implementation if the draw_shape() is not sufficient for stroking.
References draw_shape().
Referenced by draw(), Papyrus::Polyline::draw(), and Papyrus::Bezierline::draw().
Fill::pointer Papyrus::Shape::fill | ( | ) |
void Papyrus::Shape::on_fill_changed | ( | ) | [protected, virtual] |
References Papyrus::Drawable::redraw().
Referenced by set_fill(), and Shape().
void Papyrus::Shape::on_stroke_changed | ( | ) | [protected, virtual] |
References Papyrus::Drawable::invalidate_extents(), and Papyrus::Drawable::redraw().
Referenced by set_stroke(), and Shape().
void Papyrus::Shape::operator= | ( | const Shape & | other | ) |
Reimplemented in Papyrus::Bezierline, and Papyrus::Polyline.
References m_fill, m_fill_path, m_stroke, and m_stroke_path.
Papyrus::Shape::PAPYRUS_RENDERABLE | ( | Shape | ) |
Reimplemented from Papyrus::Drawable.
void Papyrus::Shape::set | ( | const AttributeValueMap & | avmap | ) | [virtual] |
Reimplemented from Papyrus::Drawable.
Reimplemented in Papyrus::Circle, Papyrus::Path, and Papyrus::Rectangle.
References Papyrus::Stroke::create(), m_stroke, set_fill(), set_stroke(), and Papyrus::strcaseeq().
void Papyrus::Shape::set_fill | ( | const Glib::ustring & | fill | ) |
Creates a new Fill object for the color and replaces the current fill with the new fill object.
References Papyrus::Fill::create(), Papyrus::Group::lookup_paint(), Papyrus::Drawable::m_parent, and set_fill().
void Papyrus::Shape::set_fill | ( | const RGBA & | color | ) |
Creates a new Fill object for the color and replaces the current fill with the new fill object.
References Papyrus::Fill::create(), and set_fill().
void Papyrus::Shape::set_fill | ( | Cairo::RefPtr< Cairo::Pattern > | pattern | ) |
Creates a new Fill object for the pattern and replaces the current fill with the new fill object.
References Papyrus::Fill::create(), and set_fill().
void Papyrus::Shape::set_fill | ( | Paint::pointer | paint | ) |
Creates a new Fill object for the paint and replaces the current fill with the new fill object.
References Papyrus::Fill::create(), and set_fill().
void Papyrus::Shape::set_fill | ( | Fill::pointer | fill | ) |
Sets the pattern that will be used to fill this shape.
References m_fill, m_fill_changed_connection, and on_fill_changed().
Referenced by set(), set_fill(), and set_fill_paint().
void Papyrus::Shape::set_fill_paint | ( | const Glib::ustring & | paint_name | ) |
Sets only the fill paint (not other fill characteristics) to the named paint.
Shapes do not inherently have a set of paints, therefore they must look to their parents. If they do not have a parent, this will have no effect.
References Papyrus::Fill::create(), m_fill, Papyrus::Drawable::m_parent, and set_fill().
void Papyrus::Shape::set_stroke | ( | const Glib::ustring & | stroke | ) |
Creates a new Stroke object for the pattern and replaces the current stroke with the new stroke object.
References Papyrus::Stroke::create(), and set_stroke().
void Papyrus::Shape::set_stroke | ( | const RGBA & | color | ) |
Creates a new Stroke object for the pattern and replaces the current stroke with the new stroke object.
References Papyrus::Stroke::create(), and set_stroke().
void Papyrus::Shape::set_stroke | ( | Cairo::RefPtr< Cairo::Pattern > | pattern | ) |
Creates a new Stroke object for the pattern and replaces the current stroke with the new stroke object.
References Papyrus::Stroke::create(), and set_stroke().
void Papyrus::Shape::set_stroke | ( | Paint::pointer | paint | ) |
Creates a new Stroke object for the paint and replaces the current stroke with the new stroke object.
References Papyrus::Stroke::create(), and set_stroke().
void Papyrus::Shape::set_stroke | ( | Stroke::pointer | stroke | ) |
Sets the stroke style that will be used to stroke this shape.
References m_stroke, m_stroke_changed_connection, and on_stroke_changed().
Referenced by Papyrus::Marker::Marker(), set(), set_stroke(), and set_stroke_paint().
void Papyrus::Shape::set_stroke_paint | ( | const Glib::ustring & | paint_name | ) |
Sets only the stroke paint (not other stroke characteristics) to the named paint.
Shapes do not inherently have a set of paints, therefore they must look to their parents. If they do not have a parent, this will have no effect.
References Papyrus::Stroke::create(), Papyrus::Drawable::m_parent, m_stroke, and set_stroke().
void Papyrus::Shape::shape_changed | ( | unsigned | which = FILL|STROKE |
) | [protected, virtual] |
References Papyrus::FILL, Papyrus::Drawable::invalidate_extents(), m_fill_path, m_stroke_path, Papyrus::Drawable::redraw(), and Papyrus::STROKE.
Referenced by Papyrus::Path::clear(), Papyrus::Path::erase(), Papyrus::Path::insert(), Papyrus::Polyline::on_marker_changed(), Papyrus::Polyline::on_vertex_changed(), Papyrus::Bezierline::on_vertex_changed(), Papyrus::Polyline::on_vertices_changed(), Papyrus::Bezierline::on_vertices_changed(), Papyrus::Path::pop_back(), Papyrus::Path::pop_front(), Papyrus::Path::push_back(), Papyrus::Path::push_front(), Papyrus::Path::remove(), Papyrus::Path::reverse(), Papyrus::Path::set(), Papyrus::Arc::set_angles(), Papyrus::Annulus::set_angles(), Papyrus::Rectangle::set_corner_radius(), Papyrus::Bezierline::set_end_marker(), Papyrus::Marker::set_facing(), Papyrus::Text::set_font_face(), Papyrus::Text::set_font_options(), Papyrus::Rectangle::set_height(), Papyrus::Marker::set_height(), Papyrus::Annulus::set_inner_radius(), Papyrus::Polyline::set_marker(), Papyrus::Annulus::set_outer_radius(), Papyrus::Annulus::set_radii(), Papyrus::Circle::set_radius(), Papyrus::Arc::set_radius(), Papyrus::Text::set_size(), Papyrus::Bezierline::set_start_marker(), Papyrus::Marker::set_style(), Papyrus::Text::set_text(), Papyrus::Rectangle::set_width(), Papyrus::Marker::set_width(), Papyrus::Marker::set_width_height(), Papyrus::Rectangle::set_xywh(), and Papyrus::Rectangle::unset_corner_radius().
Stroke::pointer Papyrus::Shape::stroke | ( | ) |
Glib::ustring Papyrus::Shape::svg_fill | ( | ) | [protected] |
References m_fill.
Referenced by Papyrus::Rectangle::svg(), Papyrus::Path::svg(), and Papyrus::Circle::svg().
Fill::pointer Papyrus::Shape::m_fill [protected] |
The fill and stroke patterns for this shape.
Referenced by draw(), Papyrus::Polyline::draw(), Papyrus::Bezierline::draw(), fill(), operator=(), set_fill(), set_fill_paint(), Shape(), and svg_fill().
sigc::connection Papyrus::Shape::m_fill_changed_connection [protected] |
Referenced by set_fill(), and Shape().
Cairo::Path* Papyrus::Shape::m_fill_path [mutable, protected] |
Referenced by draw(), operator=(), shape_changed(), and ~Shape().
Stroke::pointer Papyrus::Shape::m_stroke [protected] |
sigc::connection Papyrus::Shape::m_stroke_changed_connection [protected] |
Referenced by set_stroke(), and Shape().
Cairo::Path* Papyrus::Shape::m_stroke_path [mutable, protected] |
Referenced by draw(), operator=(), shape_changed(), and ~Shape().