Graphics

The Base.Graphics interface is an abstract wrapper; specific packages (e.g., Cairo and Tk/Gtk) implement much of the functionality.

Geometry

Vec2(x, y)

Creates a point in two dimensions

BoundingBox(xmin, xmax, ymin, ymax)

Creates a box in two dimensions with the given edges

BoundingBox(objs...)

Creates a box in two dimensions that encloses all objects

width(obj)

Computes the width of an object

height(obj)

Computes the height of an object

xmin(obj)

Computes the minimum x-coordinate contained in an object

xmax(obj)

Computes the maximum x-coordinate contained in an object

ymin(obj)

Computes the minimum y-coordinate contained in an object

ymax(obj)

Computes the maximum y-coordinate contained in an object

diagonal(obj)

Return the length of the diagonal of an object

aspect_ratio(obj)

Compute the height/width of an object

center(obj)

Return the point in the center of an object

xrange(obj)

Returns a tuple (xmin(obj), xmax(obj))

yrange(obj)

Returns a tuple (ymin(obj), ymax(obj))

rotate(obj, angle, origin) → newobj

Rotates an object around origin by the specified angle (radians), returning a new object of the same type. Because of type-constancy, this new object may not always be a strict geometric rotation of the input; for example, if obj is a BoundingBox the return is the smallest BoundingBox that encloses the rotated input.

shift(obj, dx, dy)

Returns an object shifted horizontally and vertically by the indicated amounts

*(obj, s::Real)

Scale the width and height of a graphics object, keeping the center fixed

+(bb1::BoundingBox, bb2::BoundingBox) → BoundingBox

Returns the smallest box containing both boxes

&(bb1::BoundingBox, bb2::BoundingBox) → BoundingBox

Returns the intersection, the largest box contained in both boxes

deform(bb::BoundingBox, dxmin, dxmax, dymin, dymax)

Returns a bounding box with all edges shifted by the indicated amounts

isinside(bb::BoundingBox, x, y)

True if the given point is inside the box

isinside(bb::BoundingBox, point)

True if the given point is inside the box