1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
.. _stdlib-graphics:
.. module:: Base.Graphics
Graphics
----------
The ``Base.Graphics`` interface is an abstract wrapper; specific packages (e.g., Cairo and Tk/Gtk) implement much of the functionality.
Geometry
========
.. function:: Vec2(x,y)
Creates a point in two dimensions
.. function:: BoundingBox(xmin, xmax, ymin, ymax)
Creates a box in two dimensions with the given edges
.. function:: BoundingBox(objs...)
Creates a box in two dimensions that encloses all objects
.. function:: width(obj)
Computes the width of an object
.. function:: height(obj)
Computes the height of an object
.. function:: xmin(obj)
Computes the minimum x-coordinate contained in an object
.. function:: xmax(obj)
Computes the maximum x-coordinate contained in an object
.. function:: ymin(obj)
Computes the minimum y-coordinate contained in an object
.. function:: ymax(obj)
Computes the maximum y-coordinate contained in an object
.. function:: diagonal(obj)
Return the length of the diagonal of an object
.. function:: aspect_ratio(obj)
Compute the height/width of an object
.. function:: center(obj)
Return the point in the center of an object
.. function:: xrange(obj)
Returns a tuple ``(xmin(obj), xmax(obj))``
.. function:: yrange(obj)
Returns a tuple ``(ymin(obj), ymax(obj))``
.. function:: 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.
.. function:: shift(obj, dx, dy)
Returns an object shifted horizontally and vertically by the indicated amounts
.. function:: *(obj, s::Real)
:noindex:
Scale the width and height of a graphics object, keeping the center fixed
.. function:: +(bb1::BoundingBox, bb2::BoundingBox) -> BoundingBox
:noindex:
Returns the smallest box containing both boxes
.. function:: &(bb1::BoundingBox, bb2::BoundingBox) -> BoundingBox
:noindex:
Returns the intersection, the largest box contained in both boxes
.. function:: deform(bb::BoundingBox, dxmin, dxmax, dymin, dymax)
Returns a bounding box with all edges shifted by the indicated amounts
.. function:: isinside(bb::BoundingBox, x, y)
True if the given point is inside the box
.. function:: isinside(bb::BoundingBox, point)
True if the given point is inside the box
|