gtkmm: Gsk::Stroke Class Reference

gtkmm 4.23.2

Public Member Functions | Static Public Member Functions | Protected Attributes | Related Symbols | List of all members
Gsk::Stroke Class Reference

Collects the parameters that are needed when stroking a path. More...

`#include <gskmm/stroke.h>`

## Public Member Functions
| Stroke ()
| Stroke (GskStroke * gobject, bool make_a_copy=true)
| Stroke (const Stroke & other)
Stroke & | operator= (const Stroke & other)
| Stroke (Stroke && other) noexcept
Stroke & | operator= (Stroke && other) noexcept
| ~Stroke () noexcept
void | swap (Stroke & other) noexcept
GskStroke * | gobj ()
| Provides access to the underlying C instance.
const GskStroke * | gobj () const
| Provides access to the underlying C instance.
GskStroke * | gobj_copy () const
| Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
| Stroke (float line_width)
bool | equal (const Stroke & stroke2) const
| Checks if two strokes are identical.
void | set_line_width (float line_width)
| Sets the line width to be used when stroking.
float | get_line_width () const
| Gets the line width used.
LineCap | get_line_cap () const
| Gets the line cap used.
LineJoin | get_line_join () const
| Gets the line join used.
void | set_miter_limit (float limit)
| Sets the miter limit to be used when stroking.
float | get_miter_limit () const
| Gets the miter limit.
void | set_dash (const std::vector< float > & dash)
| Sets the dash pattern to use.
std::vector< float > | get_dash () const
| Gets the dash vector in use.
void | set_dash_offset (float offset)
| Sets the offset into the dash pattern where dashing should begin.
float | get_dash_offset () const
| Gets the dash offset.
void | to_cairo (const ::Cairo::RefPtr< ::Cairo::Context > & cr) const
| A helper function that sets the stroke parameters of a cairo context from a Gsk::Stroke.

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.

## Protected Attributes
GskStroke * | gobject_

## Related Symbols
(Note that these are not member symbols.)
void | swap (Stroke & lhs, Stroke & rhs) noexcept
Gsk::Stroke | wrap (GskStroke * object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

Collects the parameters that are needed when stroking a path.

Since gtkmm 4.24

## Constructor & Destructor Documentation

## ◆ Stroke() [1/5]

Gsk::Stroke::Stroke | ( |  | ) |

## ◆ Stroke() [2/5]

Gsk::Stroke::Stroke | ( | GskStroke * | gobject,
|  | bool | make_a_copy = true )
| explicit

## ◆ Stroke() [3/5]

Gsk::Stroke::Stroke | ( | const Stroke & | other | ) |

## ◆ Stroke() [4/5]

Gsk::Stroke::Stroke | ( | Stroke && | other | ) |
| noexcept

## ◆ ~Stroke()

Gsk::Stroke::~Stroke | ( |  | ) |
| noexcept

## ◆ Stroke() [5/5]

Gsk::Stroke::Stroke | ( | float | line_width | ) |

## Member Function Documentation

## ◆ equal()

bool Gsk::Stroke::equal | ( | const Stroke & | stroke2 | ) | const

Checks if two strokes are identical.

Since gtkmm 4.24

Parameters

  stroke2 | The second stroke.

Returns
  True if the two strokes are equal, false otherwise.

## ◆ get_dash()

std::vector< float > Gsk::Stroke::get_dash | ( |  | ) | const

Gets the dash vector in use.

Since gtkmm 4.24

Returns
  The dash vector. Can be empty.

## ◆ get_dash_offset()

float Gsk::Stroke::get_dash_offset | ( |  | ) | const

Gets the dash offset.

Since gtkmm 4.24

Returns
  The dash offset.

## ◆ get_line_cap()

LineCap Gsk::Stroke::get_line_cap | ( |  | ) | const

Gets the line cap used.

See Gsk::LineCap for details.

Since gtkmm 4.24

Returns
  The line cap.

## ◆ get_line_join()

LineJoin Gsk::Stroke::get_line_join | ( |  | ) | const

Gets the line join used.

See Gsk::LineJoin for details.

Since gtkmm 4.24

Returns
  The line join.

## ◆ get_line_width()

float Gsk::Stroke::get_line_width | ( |  | ) | const

Gets the line width used.

Since gtkmm 4.24

Returns
  The line width.

## ◆ get_miter_limit()

float Gsk::Stroke::get_miter_limit | ( |  | ) | const

Gets the miter limit.

Since gtkmm 4.24

Returns
  The miter limit.

## ◆ get_type()

GType Gsk::Stroke::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ gobj() [1/2]

GskStroke * Gsk::Stroke::gobj | ( |  | ) |
| inline

Provides access to the underlying C instance.

## ◆ gobj() [2/2]

const GskStroke * Gsk::Stroke::gobj | ( |  | ) | const
| inline

Provides access to the underlying C instance.

## ◆ gobj_copy()

GskStroke * Gsk::Stroke::gobj_copy | ( |  | ) | const

Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.

## ◆ operator=() [1/2]

Stroke & Gsk::Stroke::operator= | ( | const Stroke & | other | ) |

## ◆ operator=() [2/2]

Stroke & Gsk::Stroke::operator= | ( | Stroke && | other | ) |
| noexcept

## ◆ set_dash()

void Gsk::Stroke::set_dash | ( | const std::vector< float > & | dash | ) |

Sets the dash pattern to use.

A dash pattern is specified by a vector of alternating non-negative values. Each value provides the length of alternate "on" and "off" portions of the stroke.

Each "on" segment will have caps applied as if the segment were a separate contour. In particular, it is valid to use an "on" length of 0 with Gsk::LineCap::ROUND or Gsk::LineCap::SQUARE to draw dots or squares along a path.

If dash is an empty vector, if all elements in dash are 0, or if there are negative values in dash, then dashing is disabled.

If dash.size() is 1, an alternating "on" and "off" pattern with the single dash length provided is assumed.

If dash.size() is uneven, the dash vector will be used with the first element in dash defining an "on" or "off" in alternating passes through the vector.

You can specify a starting offset into the dash with set_dash_offset().

Since gtkmm 4.24

Parameters

  dash | The vector of dashes.

## ◆ set_dash_offset()

void Gsk::Stroke::set_dash_offset | ( | float | offset | ) |

Sets the offset into the dash pattern where dashing should begin.

This is an offset into the length of the path, not an index into the array values of the dash array.

See set_dash() for more details on dashing.

Since gtkmm 4.24

Parameters

  offset | Offset into the dash pattern.

## ◆ set_line_width()

void Gsk::Stroke::set_line_width | ( | float | line_width | ) |

Sets the line width to be used when stroking.

The line width must be >= 0.

Since gtkmm 4.24

Parameters

  line_width | Width of the line in pixels.

## ◆ set_miter_limit()

void Gsk::Stroke::set_miter_limit | ( | float | limit | ) |

Sets the miter limit to be used when stroking.

The miter limit is the distance from the corner where sharp turns of joins get cut off.

The limit is specfied in units of line width and must be non-negative.

For joins of type Gsk::LineJoin::MITER that exceed the miter limit, the join gets rendered as if it was of type Gsk::LineJoin::BEVEL.

Since gtkmm 4.24

Parameters

  limit | The miter limit.

## ◆ swap()

void Gsk::Stroke::swap | ( | Stroke & | other | ) |
| noexcept

## ◆ to_cairo()

void Gsk::Stroke::to_cairo | ( | const ::Cairo::RefPtr< ::Cairo::Context > & | cr | ) | const

A helper function that sets the stroke parameters of a cairo context from a Gsk::Stroke.

Since gtkmm 4.24

Parameters

  cr | The cairo context to configure.

## Friends And Related Symbol Documentation

## ◆ swap()

void swap | ( | Stroke & | lhs,
|  | Stroke & | rhs )
| related

Parameters

  lhs | The left-hand side
  rhs | The right-hand side

## ◆ wrap()

Gsk::Stroke wrap | ( | GskStroke * | object,
|  | bool | take_copy = false )
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.

## Member Data Documentation

## ◆ gobject_

GskStroke* Gsk::Stroke::gobject_
| protected