package stk
Install
Dune Dependency
Authors
Maintainers
Sources
md5=c334ffabde8b710f1eba6699db0f601a
sha512=7978e3f10bc196ee6177ded9ae0313a5ba65e1a74e501fbecbe5ebc216ca6ee7117deaff5bc4c414083a4a55851a81e5dedaa8d0a880ad72689b3f56f3b064f5
doc/stk/Stk/G/index.html
Module Stk.G
Source
Geometry.
This module is used to represent and compute widget coordinates.
A geometry is rectangle. x
and y
are coordinates of top-left corner.
seg_inter x1 w1 x2 w2
returns the intersection segment (left..right) between segments (x1..(x1+w1))
and (x2..(x2+w2))
, if any.
inside ~x ~y g
returns true
is point (x, y)
is inside g
.
translate ~x ~y g
returns a new geometry, adding x
(resp. y
) to g.x
(resp. g.y
) if specified.
enlarge ~w ~h g
returns a new geometry whose width (resp. height) is increased by 2 * w
(resp. 2 * h
). g.x
(resp. g.y
) is translated by -w
(resp. -h
) so that the final geometry remains centered with report to the original one.
to_rect g
creates a Tsdl.Sdl.rect
from g
.
of_rect r
creates a geometry t
from a Tsdl.Sdl.rect
.
has_intersect g1 g2
returns true
if intersection g1 g2 <> None
.
remove_border g borders
returns a new geometry by removing borders from g
. It is ensured that the returned geometry has non-negative width and height.