Inkscape
Vector Graphics Editor
|
#include <canvas-item-curve.h>
Public Member Functions | |
CanvasItemCurve (CanvasItemGroup *group) | |
Create an null control curve. | |
CanvasItemCurve (CanvasItemGroup *group, Geom::Point const &p0, Geom::Point const &p1) | |
Create a linear control curve. | |
CanvasItemCurve (CanvasItemGroup *group, Geom::Point const &p0, Geom::Point const &p1, Geom::Point const &p2, Geom::Point const &p3) | |
Create a cubic Bezier control curve. | |
void | set_coords (Geom::Point const &p0, Geom::Point const &p1) |
Set a linear control curve. | |
void | set_coords (Geom::Point const &p0, Geom::Point const &p1, Geom::Point const &p2, Geom::Point const &p3) |
Set a cubic Bezier control curve. | |
void | set_width (int width) |
Set stroke width. | |
void | set_bg_alpha (float alpha) |
Set background stroke alpha. | |
bool | is_line () const |
double | closest_distance_to (Geom::Point const &p) const |
Returns distance between point in canvas units and nearest point on curve. | |
bool | contains (Geom::Point const &p, double tolerance=0) override |
Returns true if point p (in canvas units) is within tolerance (canvas units) distance of curve. | |
![]() | |
CanvasItem (CanvasItemContext *context) | |
CanvasItem (CanvasItemGroup *parent) | |
CanvasItem (CanvasItem const &)=delete | |
CanvasItem & | operator= (CanvasItem const &)=delete |
void | unlink () |
UI::Widget::Canvas * | get_canvas () const |
CanvasItemGroup * | get_parent () const |
bool | is_descendant_of (CanvasItem const *ancestor) const |
void | set_z_position (int zpos) |
void | raise_to_top () |
void | lower_to_bottom () |
void | request_update () |
void | update (bool propagate) |
virtual void | visit_page_rects (std::function< void(Geom::Rect const &)> const &) const |
Geom::OptRect const & | get_bounds () const |
void | grab (EventMask event_mask, Glib::RefPtr< Gdk::Cursor > const &={}) |
void | ungrab () |
void | render (Inkscape::CanvasItemBuffer &buf) const |
bool | is_visible () const |
virtual void | set_visible (bool visible) |
void | request_redraw () |
virtual void | set_fill (uint32_t rgba) |
void | set_fill (CanvasItemColor color) |
void | set_fill_pattern (Cairo::RefPtr< Cairo::Pattern > pattern) |
virtual void | set_stroke (uint32_t rgba) |
void | set_stroke (CanvasItemColor color) |
void | set_stroke_width (double width) |
Set the stroke width. | |
void | set_outline (uint32_t color) |
Set the outline color. | |
void | set_outline_width (double width) |
Set the outline width. | |
double | get_effective_outline () const |
Get the effective outline. | |
void | set_name (std::string &&name) |
std::string const & | get_name () const |
void | update_canvas_item_ctrl_sizes (int size_index) |
void | set_pickable (bool pickable) |
bool | is_pickable () const |
sigc::connection | connect_event (sigc::slot< bool(CanvasEvent const &)> const &slot) |
virtual bool | handle_event (CanvasEvent const &event) |
void | canvas_item_print_tree (int level=0, int zorder=0) const |
Protected Member Functions | |
~CanvasItemCurve () override=default | |
void | _update (bool propagate) override |
Update and redraw control curve. | |
void | _render (Inkscape::CanvasItemBuffer &buf) const override |
Render curve to screen via Cairo. | |
![]() | |
virtual | ~CanvasItem () |
Geom::Affine const & | affine () const |
virtual void | _mark_net_invisible () |
virtual void | _invalidate_ctrl_handles () |
template<typename F > | |
void | defer (F &&f) |
Protected Attributes | |
std::unique_ptr< Geom::BezierCurve > | _curve |
int | _width = 1 |
int | background_width = 3 |
float | bg_alpha = 0.5f |
![]() | |
CanvasItemContext * | _context |
CanvasItemGroup * | _parent |
Geom::OptRect | _bounds |
bool | _need_update = false |
bool | _visible = true |
bool | _net_visible = true |
bool | _pickable = false |
uint32_t | _fill = CANVAS_ITEM_COLORS[CANVAS_ITEM_SECONDARY] |
Cairo::RefPtr< Cairo::Pattern > | _fill_pattern |
uint32_t | _stroke = CANVAS_ITEM_COLORS[CANVAS_ITEM_PRIMARY] |
double | _stroke_width = 1.0 |
uint32_t | _outline = 0x0 |
double | _outline_width = 0 |
std::string | _name |
sigc::signal< bool(CanvasEvent const &)> | _event_signal |
Additional Inherited Members | |
![]() | |
boost::intrusive::list_member_hook | member_hook |
Definition at line 27 of file canvas-item-curve.h.
Inkscape::CanvasItemCurve::CanvasItemCurve | ( | CanvasItemGroup * | group | ) |
Create an null control curve.
Definition at line 30 of file canvas-item-curve.cpp.
References Inkscape::CanvasItem::_name.
Inkscape::CanvasItemCurve::CanvasItemCurve | ( | CanvasItemGroup * | group, |
Geom::Point const & | p0, | ||
Geom::Point const & | p1 | ||
) |
Create a linear control curve.
Points are in document coordinates.
Definition at line 39 of file canvas-item-curve.cpp.
References Inkscape::CanvasItem::_name.
Inkscape::CanvasItemCurve::CanvasItemCurve | ( | CanvasItemGroup * | group, |
Geom::Point const & | p0, | ||
Geom::Point const & | p1, | ||
Geom::Point const & | p2, | ||
Geom::Point const & | p3 | ||
) |
Create a cubic Bezier control curve.
Points are in document coordinates.
Definition at line 49 of file canvas-item-curve.cpp.
References Inkscape::CanvasItem::_name.
|
overrideprotecteddefault |
|
overrideprotectedvirtual |
Render curve to screen via Cairo.
Implements Inkscape::CanvasItem.
Definition at line 153 of file canvas-item-curve.cpp.
References _curve, Inkscape::CanvasItem::_stroke, _width, Inkscape::CanvasItem::affine(), background_width, bg_alpha, buf, and ink_cairo_set_source_color().
|
overrideprotectedvirtual |
Update and redraw control curve.
Implements Inkscape::CanvasItem.
Definition at line 132 of file canvas-item-curve.cpp.
References Inkscape::CanvasItem::_bounds, _curve, Inkscape::CanvasItem::affine(), expandedBy(), and Inkscape::CanvasItem::request_redraw().
double Inkscape::CanvasItemCurve::closest_distance_to | ( | Geom::Point const & | p | ) | const |
Returns distance between point in canvas units and nearest point on curve.
Definition at line 109 of file canvas-item-curve.cpp.
References _curve, Inkscape::CanvasItem::affine(), Geom::distance(), and Geom::infinity().
Referenced by contains().
|
overridevirtual |
Returns true if point p (in canvas units) is within tolerance (canvas units) distance of curve.
Reimplemented from Inkscape::CanvasItem.
Definition at line 124 of file canvas-item-curve.cpp.
References closest_distance_to().
|
inline |
Definition at line 40 of file canvas-item-curve.h.
References _curve.
void Inkscape::CanvasItemCurve::set_bg_alpha | ( | float | alpha | ) |
Set background stroke alpha.
Definition at line 97 of file canvas-item-curve.cpp.
References bg_alpha, Inkscape::CanvasItem::defer(), and Inkscape::CanvasItem::request_update().
Referenced by Inkscape::Display::SnapIndicator::make_alignment_indicator().
void Inkscape::CanvasItemCurve::set_coords | ( | Geom::Point const & | p0, |
Geom::Point const & | p1 | ||
) |
Set a linear control curve.
Points are in document coordinates.
Definition at line 61 of file canvas-item-curve.cpp.
References _curve, Inkscape::CanvasItem::_name, Inkscape::CanvasItem::defer(), and Inkscape::CanvasItem::request_update().
void Inkscape::CanvasItemCurve::set_coords | ( | Geom::Point const & | p0, |
Geom::Point const & | p1, | ||
Geom::Point const & | p2, | ||
Geom::Point const & | p3 | ||
) |
Set a cubic Bezier control curve.
Points are in document coordinates.
Definition at line 73 of file canvas-item-curve.cpp.
References _curve, Inkscape::CanvasItem::_name, Inkscape::CanvasItem::defer(), and Inkscape::CanvasItem::request_update().
void Inkscape::CanvasItemCurve::set_width | ( | int | width | ) |
Set stroke width.
Definition at line 85 of file canvas-item-curve.cpp.
References _width, Inkscape::CanvasItem::defer(), Inkscape::CanvasItem::request_update(), and width.
|
protected |
Definition at line 54 of file canvas-item-curve.h.
Referenced by _render(), _update(), closest_distance_to(), is_line(), set_coords(), and set_coords().
|
protected |
Definition at line 56 of file canvas-item-curve.h.
Referenced by _render(), and set_width().
|
protected |
Definition at line 57 of file canvas-item-curve.h.
Referenced by _render().
|
protected |
Definition at line 58 of file canvas-item-curve.h.
Referenced by _render(), and set_bg_alpha().