package ocgtk

  1. Overview
  2. Docs
OCaml bindings for GTK 4

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1-preview2.tar.gz
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054

doc/ocgtk.gsk/Ocgtk_gsk/Gsk/Wrappers/Path/index.html

Module Wrappers.Path

type t = [ `path ] Gobject.obj
val to_string : t -> string

Converts the path into a string that is suitable for printing.

You can use this function in a debugger to get a quick overview of the path.

This is a wrapper around method@Gsk.Path.print, see that function for details.

val to_cairo : t -> Ocgtk_cairo.Cairo.Wrappers.Context.t -> unit

Appends the given @path to the given cairo context for drawing with Cairo.

This may cause some suboptimal conversions to be performed as Cairo does not support all features of `GskPath`.

This function does not clear the existing Cairo path. Call cairo_new_path() if you want this.

val ref : t -> t

Increases the reference count of a `GskPath` by one.

val is_empty : t -> bool

Checks if the path is empty, i.e. contains no lines or curves.

val is_closed : t -> bool

Returns if the path represents a single closed contour.

Returns whether the given point is inside the area that would be affected if the path was filled according to @fill_rule.

Note that this function assumes that filling a contour implicitly closes it.

val get_stroke_bounds : t -> [ `stroke ] Gobject.obj -> bool * Ocgtk_graphene.Graphene.Wrappers.Rect.t

Computes the bounds for stroking the given path with the parameters in @stroke.

The returned bounds may be larger than necessary, because this function aims to be fast, not accurate. The bounds are guaranteed to contain the area affected by the stroke, including protrusions like miters.

val get_start_point : t -> bool * [ `path_point ] Gobject.obj

Gets the start point of the path.

An empty path has no points, so `FALSE` is returned in this case.

val get_end_point : t -> bool * [ `path_point ] Gobject.obj

Gets the end point of the path.

An empty path has no points, so `FALSE` is returned in this case.

val get_closest_point : t -> Ocgtk_graphene.Graphene.Wrappers.Point.t -> float -> bool * [ `path_point ] Gobject.obj * float

Computes the closest point on the path to the given point and sets the @result to it.

If there is no point closer than the given threshold, `FALSE` is returned.

val get_bounds : t -> bool * Ocgtk_graphene.Graphene.Wrappers.Rect.t

Computes the bounds of the given path.

The returned bounds may be larger than necessary, because this function aims to be fast, not accurate. The bounds are guaranteed to contain the path.

It is possible that the returned rectangle has 0 width and/or height. This can happen when the path only describes a point or an axis-aligned line.

If the path is empty, `FALSE` is returned and @bounds are set to graphene_rect_zero(). This is different from the case where the path is a single point at the origin, where the @bounds will also be set to the zero rectangle but `TRUE` will be returned.