#include <papyrus/shape.h>
Inheritance diagram for Papyrus::Shape:
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 draw_outline() method.
Public Types | |
typedef PapyrusSmartPointer< Shape > | pointer |
Public Member Functions | |
virtual | ~Shape () |
Destructor. | |
virtual void | draw (Cairo::RefPtr< Cairo::Context > cairo) |
Override of Drawable's virtual draw method that takes care of filling and stroking the shape when the fill and/or outline patterns are present. | |
virtual void | draw_shape (Cairo::RefPtr< Cairo::Context > cairo)=0 |
Children should provide their own implementations of this pure virtual method. | |
virtual void | draw_outline (Cairo::RefPtr< Cairo::Context > cairo) |
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 outlining. | |
Cairo::RefPtr< Cairo::Pattern > | fill () |
The pattern that will be used to fill this shape. | |
void | set_fill (Cairo::RefPtr< Cairo::Pattern > fill=Cairo::RefPtr< Cairo::Pattern >()) |
Sets the pattern that will be used to fill this shape. | |
LineStyle & | outline () |
The LineStyle that will be used to draw the outline. | |
void | set_outline (const LineStyle &outline, bool use_outline=true) |
Sets the line style that will be used to outline this shape. | |
void | set_outline (Cairo::RefPtr< Cairo::Pattern > pattern, bool use_outline=true) |
Sets the line style that will be used to outline this shape. | |
bool | use_outline () |
True if an outline will be drawn, false otherwise. | |
void | set_use_outline (bool use_outline) |
Set to true if an outline should be drawn, false if an outline should not be drawn. | |
PAPYRUS_CLASS_NAME ("Shape") | |
Protected Member Functions | |
Shape (Cairo::RefPtr< Cairo::Pattern > fill=Cairo::RefPtr< Cairo::Pattern >()) | |
Constructor that accepts a fill pattern. | |
Shape (Cairo::RefPtr< Cairo::Pattern > fill, const LineStyle &outline) | |
Constructor that accepts a fill and outline pattern. | |
virtual void | set_extents (const Region &extents) |
Reimplemented to ensure that outline width, if set, is taken into account. | |
virtual void | on_outline_changed () |
virtual void | shape_changed (unsigned which=FILL|OUTLINE) |
Protected Attributes | |
Cairo::RefPtr< Cairo::Pattern > | m_fill |
The fill and outline patterns for this shape. | |
LineStyle | m_outline |
bool | m_use_outline |
Cairo::Path * | m_fill_path |
Cairo::Path * | m_outline_path |
sigc::connection | m_outline_changed_connection |
Region | m_internal_extents |
virtual void Papyrus::Shape::draw_shape | ( | Cairo::RefPtr< Cairo::Context > | cairo | ) | [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::Arc, Papyrus::Bezierline, Papyrus::Marker, Papyrus::Polyline, and Papyrus::Rectangle.
void Papyrus::Shape::set_outline | ( | const LineStyle & | outline, | |
bool | use_outline = true | |||
) |
Sets the line style that will be used to outline this shape.
set_use_outline | defaults to true and turns on outlining |
void Papyrus::Shape::set_outline | ( | Cairo::RefPtr< Cairo::Pattern > | pattern, | |
bool | use_outline = true | |||
) |
Sets the line style that will be used to outline this shape.
set_use_outline | defaults to true and turns on outlining |