Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::CanvasItemCurve Class Referencefinal

#include <canvas-item-curve.h>

Inheritance diagram for Inkscape::CanvasItemCurve:
Inkscape::CanvasItem

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.
 
- Public Member Functions inherited from Inkscape::CanvasItem
 CanvasItem (CanvasItemContext *context)
 
 CanvasItem (CanvasItemGroup *parent)
 
 CanvasItem (CanvasItem const &)=delete
 
CanvasItemoperator= (CanvasItem const &)=delete
 
void unlink ()
 
UI::Widget::Canvasget_canvas () const
 
CanvasItemGroupget_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.
 
- Protected Member Functions inherited from Inkscape::CanvasItem
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
 
- Protected Attributes inherited from Inkscape::CanvasItem
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

- Public Attributes inherited from Inkscape::CanvasItem
boost::intrusive::list_member_hook member_hook
 

Detailed Description

Definition at line 27 of file canvas-item-curve.h.

Constructor & Destructor Documentation

◆ CanvasItemCurve() [1/3]

Inkscape::CanvasItemCurve::CanvasItemCurve ( CanvasItemGroup group)

Create an null control curve.

Definition at line 30 of file canvas-item-curve.cpp.

References Inkscape::CanvasItem::_name.

◆ CanvasItemCurve() [2/3]

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.

◆ CanvasItemCurve() [3/3]

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.

◆ ~CanvasItemCurve()

Inkscape::CanvasItemCurve::~CanvasItemCurve ( )
overrideprotecteddefault

Member Function Documentation

◆ _render()

void Inkscape::CanvasItemCurve::_render ( Inkscape::CanvasItemBuffer buf) const
overrideprotectedvirtual

◆ _update()

void Inkscape::CanvasItemCurve::_update ( bool  propagate)
overrideprotectedvirtual

◆ closest_distance_to()

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().

◆ contains()

bool Inkscape::CanvasItemCurve::contains ( Geom::Point const &  p,
double  tolerance = 0 
)
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().

◆ is_line()

bool Inkscape::CanvasItemCurve::is_line ( ) const
inline

Definition at line 40 of file canvas-item-curve.h.

References _curve.

◆ set_bg_alpha()

void Inkscape::CanvasItemCurve::set_bg_alpha ( float  alpha)

◆ set_coords() [1/2]

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().

◆ set_coords() [2/2]

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().

◆ set_width()

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.

Member Data Documentation

◆ _curve

std::unique_ptr<Geom::BezierCurve> Inkscape::CanvasItemCurve::_curve
protected

◆ _width

int Inkscape::CanvasItemCurve::_width = 1
protected

Definition at line 56 of file canvas-item-curve.h.

Referenced by _render(), and set_width().

◆ background_width

int Inkscape::CanvasItemCurve::background_width = 3
protected

Definition at line 57 of file canvas-item-curve.h.

Referenced by _render().

◆ bg_alpha

float Inkscape::CanvasItemCurve::bg_alpha = 0.5f
protected

Definition at line 58 of file canvas-item-curve.h.

Referenced by _render(), and set_bg_alpha().


The documentation for this class was generated from the following files: