A rectangle centered on the x,y coordinate. More...
#include <rectangle.h>
Public Member Functions | |
PAPYRUS_DRAWABLE (Rectangle) | |
virtual | ~Rectangle () |
virtual void | set (const AttributeValueMap &avmap) |
double | width () |
Returns the width of the rectangle. | |
double | height () |
Returns the height of the rectangle. | |
void | xywh (double &x, double &y, double &w, double &h) |
Fills parameters w and h with the width and height of the rectangle. | |
void | set_width (double w) |
Sets the width of the rectangle to w. | |
void | set_height (double h) |
Sets the height of the rectangle to h. | |
void | set_xywh (double x, double y, double w, double h) |
Sets the center of the rectangle to (x,y) and also sets the width and height of the rectangle. | |
void | set_xywh (const Region &r) |
double | corner_radius () |
If not NAN will draw a rectangle with rounded corners. | |
void | set_corner_radius (double r) |
Draws a rounded rectangle using the provided radius. | |
void | unset_corner_radius () |
Unsets the corner radius. | |
virtual void | draw_shape (Context &cairo) const |
Draws on the provided context. | |
virtual Glib::ustring | svg (unsigned depth=0) |
sigc::signal< void > | signal_size () |
signal emitted when the size of the rectangle is changed | |
Static Public Member Functions | |
static Rectangle::pointer | create (double x, double y, double w, double h, Fill::pointer fill=Fill::pointer(), Stroke::pointer stroke=Stroke::pointer()) |
static Rectangle::pointer | create (double w=0.0, double h=0.0, Fill::pointer fill=Fill::pointer(), Stroke::pointer stroke=Stroke::pointer()) |
Creates a rectangle of a specified width and height. | |
static Rectangle::pointer | create (const Glib::ustring &id, double x, double y, double w, double h, Fill::pointer fill=Fill::pointer(), Stroke::pointer stroke=Stroke::pointer()) |
static Rectangle::pointer | create (const Glib::ustring &id, double w, double h, Fill::pointer fill=Fill::pointer(), Stroke::pointer stroke=Stroke::pointer()) |
static Rectangle::pointer | create (const AttributeValueMap &avmap) |
Protected Member Functions | |
Rectangle (const Glib::ustring &id, double x, double y, double w, double h, Fill::pointer fill, Stroke::pointer stroke) | |
Rectangle (const AttributeValueMap &avmap) | |
virtual Region | calculate_extents (const Matrix &m=Matrix::Identity, ExtentsPerformance ep=EXTENTS_QUICK) const |
Reimplments the extent calculation to optimize quick extents without rendering to the sidebuffer. | |
Protected Attributes | |
double | m_width |
double | m_height |
double | m_corner_radius |
sigc::signal< void > | m_signal_size |
A rectangle centered on the x,y coordinate.
Rectangle
Papyrus::Rectangle::Rectangle | ( | const Glib::ustring & | id, | |
double | x, | |||
double | y, | |||
double | w, | |||
double | h, | |||
Fill::pointer | fill, | |||
Stroke::pointer | stroke | |||
) | [protected] |
References Papyrus::Drawable::set_x(), and Papyrus::Drawable::set_y().
Referenced by create().
Papyrus::Rectangle::Rectangle | ( | const AttributeValueMap & | avmap | ) | [protected] |
Papyrus::Rectangle::~Rectangle | ( | ) | [virtual] |
Region Papyrus::Rectangle::calculate_extents | ( | const Matrix & | m = Matrix::Identity , |
|
ExtentsPerformance | ep = EXTENTS_QUICK | |||
) | const [protected, virtual] |
Reimplments the extent calculation to optimize quick extents without rendering to the sidebuffer.
Reimplemented from Papyrus::Drawable.
References Papyrus::EXTENTS_QUICK, Papyrus::Region::include(), m_height, Papyrus::Shape::m_stroke, m_width, Papyrus::Matrix::transform_point(), width(), Papyrus::Drawable::x(), and Papyrus::Drawable::y().
double Papyrus::Rectangle::corner_radius | ( | ) |
If not NAN will draw a rectangle with rounded corners.
References m_corner_radius.
Rectangle::pointer Papyrus::Rectangle::create | ( | const AttributeValueMap & | avmap | ) | [static] |
References PAPYRUS_CREATE, and Rectangle().
Rectangle::pointer Papyrus::Rectangle::create | ( | const Glib::ustring & | id, | |
double | w, | |||
double | h, | |||
Fill::pointer | fill = Fill::pointer() , |
|||
Stroke::pointer | stroke = Stroke::pointer() | |||
) | [static] |
References PAPYRUS_CREATE.
Rectangle::pointer Papyrus::Rectangle::create | ( | const Glib::ustring & | id, | |
double | x, | |||
double | y, | |||
double | w, | |||
double | h, | |||
Fill::pointer | fill = Fill::pointer() , |
|||
Stroke::pointer | stroke = Stroke::pointer() | |||
) | [static] |
References PAPYRUS_CREATE.
Rectangle::pointer Papyrus::Rectangle::create | ( | double | w = 0.0 , |
|
double | h = 0.0 , |
|||
Fill::pointer | fill = Fill::pointer() , |
|||
Stroke::pointer | stroke = Stroke::pointer() | |||
) | [static] |
Creates a rectangle of a specified width and height.
References PAPYRUS_CREATE.
Rectangle::pointer Papyrus::Rectangle::create | ( | double | x, | |
double | y, | |||
double | w, | |||
double | h, | |||
Fill::pointer | fill = Fill::pointer() , |
|||
Stroke::pointer | stroke = Stroke::pointer() | |||
) | [static] |
References PAPYRUS_CREATE.
Referenced by Papyrus::SVG::process_element().
void Papyrus::Rectangle::draw_shape | ( | Context & | cairo | ) | const [virtual] |
Draws on the provided context.
Implements Papyrus::Shape.
References m_corner_radius, m_height, and m_width.
double Papyrus::Rectangle::height | ( | ) |
Returns the height of the rectangle.
References m_height.
Papyrus::Rectangle::PAPYRUS_DRAWABLE | ( | Rectangle | ) |
void Papyrus::Rectangle::set | ( | const AttributeValueMap & | avmap | ) | [virtual] |
Reimplemented from Papyrus::Shape.
References set_height(), set_width(), and Papyrus::strcaseeq().
void Papyrus::Rectangle::set_corner_radius | ( | double | r | ) |
Draws a rounded rectangle using the provided radius.
References m_corner_radius, and Papyrus::Shape::shape_changed().
void Papyrus::Rectangle::set_height | ( | double | h | ) |
Sets the height of the rectangle to h.
References Papyrus::Drawable::freeze(), m_height, m_signal_size, Papyrus::Drawable::set_centroid_y(), Papyrus::Shape::shape_changed(), and Papyrus::Drawable::thaw().
Referenced by set().
void Papyrus::Rectangle::set_width | ( | double | w | ) |
Sets the width of the rectangle to w.
References Papyrus::Drawable::freeze(), m_signal_size, m_width, Papyrus::Drawable::set_centroid_x(), Papyrus::Shape::shape_changed(), and Papyrus::Drawable::thaw().
Referenced by set().
void Papyrus::Rectangle::set_xywh | ( | const Region & | r | ) |
References set_xywh(), Papyrus::Drawable::x(), Papyrus::Region::xywh(), and Papyrus::Drawable::y().
void Papyrus::Rectangle::set_xywh | ( | double | x, | |
double | y, | |||
double | w, | |||
double | h | |||
) |
Sets the center of the rectangle to (x,y) and also sets the width and height of the rectangle.
References Papyrus::Drawable::freeze(), m_height, m_signal_size, m_width, Papyrus::Drawable::set_centroid(), Papyrus::Drawable::set_x(), Papyrus::Drawable::set_y(), Papyrus::Shape::shape_changed(), and Papyrus::Drawable::thaw().
Referenced by set_xywh().
sigc::signal< void > Papyrus::Rectangle::signal_size | ( | ) |
signal emitted when the size of the rectangle is changed
References m_signal_size.
Glib::ustring Papyrus::Rectangle::svg | ( | unsigned | depth = 0 |
) | [virtual] |
Reimplemented from Papyrus::Renderable.
References m_height, m_width, Papyrus::Shape::svg_fill(), Papyrus::Renderable::svg_id(), Papyrus::Renderable::svg_spacing(), Papyrus::Drawable::svg_transform(), Papyrus::Drawable::x(), and Papyrus::Drawable::y().
void Papyrus::Rectangle::unset_corner_radius | ( | ) |
Unsets the corner radius.
The corner radius can be unset either by: # Use unset_corner_radius()
to explicitly unset # Set the corner radius to NAN
or a negative number
References m_corner_radius, and Papyrus::Shape::shape_changed().
double Papyrus::Rectangle::width | ( | ) |
void Papyrus::Rectangle::xywh | ( | double & | x, | |
double & | y, | |||
double & | w, | |||
double & | h | |||
) |
Fills parameters w and h with the width and height of the rectangle.
References m_height, m_width, Papyrus::Drawable::x(), and Papyrus::Drawable::y().
double Papyrus::Rectangle::m_corner_radius [protected] |
Referenced by corner_radius(), draw_shape(), set_corner_radius(), and unset_corner_radius().
double Papyrus::Rectangle::m_height [protected] |
Referenced by calculate_extents(), draw_shape(), height(), set_height(), set_xywh(), svg(), and xywh().
sigc::signal<void> Papyrus::Rectangle::m_signal_size [protected] |
Referenced by set_height(), set_width(), set_xywh(), and signal_size().
double Papyrus::Rectangle::m_width [protected] |
Referenced by calculate_extents(), draw_shape(), set_width(), set_xywh(), svg(), width(), and xywh().