LayOut C API

- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Enumerations | Functions
rectangle.h File Reference
`#include <LayOutAPI/common.h>`
`#include <LayOutAPI/geometry/geometry.h>`
`#include <LayOutAPI/model/defs.h>`

Go to the source code of this file.

## Enumerations
enum | LORectangleType { LORectangleType_Normal = 0, LORectangleType_Rounded, LORectangleType_Lozenge, LORectangleType_Bulged, LONumRectangleTypes }
| Defines the shape of the rectangle within its boundaries. More...

## Functions
LO_RESULT | LORectangleCreate (LORectangleRef *rectangle, const LOAxisAlignedRect2D *bounds)
| Creates a 'normal' rectangle with 90 degree corners. More...
LO_RESULT | LORectangleCreateRounded (LORectangleRef *rectangle, const LOAxisAlignedRect2D *bounds, double corner_radius)
| Creates a 'rounded' rectangle with arcs in each corner. More...
LO_RESULT | LORectangleCreateLozenge (LORectangleRef *rectangle, const LOAxisAlignedRect2D *bounds)
| Creates a 'Lozenge' rectangle with the shorter side curved. More...
LO_RESULT | LORectangleCreateBulged (LORectangleRef *rectangle, const LOAxisAlignedRect2D *bounds, double bulge_distance)
| Creates a 'bulged' rectangle with the vertical sides curved. More...
LO_RESULT | LORectangleAddReference (LORectangleRef rectangle)
| Adds a reference to a rectangle object. More...
LO_RESULT | LORectangleRelease (LORectangleRef *rectangle)
| Releases a rectangle object. The object will be invalidated if releasing the last reference. More...
LO_EXPORT LORectangleRef | LORectangleFromEntity (LOEntityRef entity)
| Converts from a LOEntityRef to a LORectangleRef. This is essentially a downcast operation so the given LOEntityRef must be convertible to a LORectangleRef. More...
LO_EXPORT LOEntityRef | LORectangleToEntity (LORectangleRef rectangle)
| Converts from a LORectangleRef to a LOEntityRef. This is essentially an upcast operation. More...
LO_RESULT | LORectangleGetTopLeftPoint (LORectangleRef rectangle, LOPoint2D *point)
| Gets the point that was originally defined as the upper left point. Transforms to this object may have moved it so that it is no longer the top left point geometrically on the page. More...
LO_RESULT | LORectangleGetTopRightPoint (LORectangleRef rectangle, LOPoint2D *point)
| Gets the point that was originally defined as the upper right point. Transforms to this object may have moved it so that it is no longer the top right point geometrically on the page. More...
LO_RESULT | LORectangleGetBottomLeftPoint (LORectangleRef rectangle, LOPoint2D *point)
| Gets the point that was originally defined as the bottom left point. Transforms to this object may have moved it so that it is no longer the bottom left point geometrically on the page. More...
LO_RESULT | LORectangleGetBottomRightPoint (LORectangleRef rectangle, LOPoint2D *point)
| Gets the point that was originally defined as the bottom right point. Transforms to this object may have moved it so that it is no longer the bottom right point geometrically on the page. More...
LO_RESULT | LORectangleGetRectangleType (LORectangleRef rectangle, LORectangleType *type)
| Gets the type of a rectangle. More...
LO_RESULT | LORectangleSetRectangleType (LORectangleRef rectangle, LORectangleType type)
| Gets the type of a rectangle. More...
LO_RESULT | LORectangleGetRadius (LORectangleRef rectangle, double *radius)
| Returns the radius that defines the shape of a bulged or rounded rectangle. More...
LO_RESULT | LORectangleSetRadius (LORectangleRef rectangle, double radius)
| Sets the radius that defines the shape of a bulged or rounded rectangle. More...

## Enumeration Type Documentation

enum LORectangleType

Defines the shape of the rectangle within its boundaries.

Enumerator
LORectangleType_Normal | Normal rectangle with 90 degree corners.
LORectangleType_Rounded | Rectangle with rounded corners and a specified radius.
LORectangleType_Lozenge | Rectangle with rounded corners and a radius equal to half the smaller of width or height.
LORectangleType_Bulged | Rectangle whose left and right sides are arcs with a specified radius.
LONumRectangleTypes |

## Function Documentation

LO_RESULT LORectangleAddReference | ( | LORectangleRef | rectangle | ) |

Adds a reference to a rectangle object.

Parameters

  [in] | rectangle | The rectangle object.

Returns
  SU_ERROR_NONE on success SU_ERROR_INVALID_INPUT if rectangle does not refer to a valid object

LO_RESULT LORectangleCreate | ( | LORectangleRef * | rectangle,
|  | const LOAxisAlignedRect2D * | bounds
| ) |  |

Creates a 'normal' rectangle with 90 degree corners.

Parameters

  [out] | rectangle | The rectangle object.
  [in] | bounds | The starting dimensions of the rectangle.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_OUTPUT if rectangle is NULL
  - SU_ERROR_OVERWRITE_VALID if *rectangle already refers to a valid object
  - SU_ERROR_NULL_POINTER_INPUT if bounds is NULL
  - SU_ERROR_OUT_OF_RANGE if bounds has a width or height of zero

LO_RESULT LORectangleCreateBulged | ( | LORectangleRef * | rectangle,
|  | const LOAxisAlignedRect2D * | bounds,
|  | double | bulge_distance
| ) |  |

Creates a 'bulged' rectangle with the vertical sides curved.

Parameters

  [out] | rectangle | The rectangle object.
  [in] | bounds | The starting dimensions of the rectangle.
  [in] | bulge_distance | The size of the bulge, from the outer edge of the rectangle in.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_OUTPUT if rectangle is NULL
  - SU_ERROR_OVERWRITE_VALID if *rectangle already refers to a valid object
  - SU_ERROR_NULL_POINTER_INPUT if bounds is NULL
  - SU_ERROR_OUT_OF_RANGE if bounds has a width or height of zero
  - SU_ERROR_OUT_OF_RANGE if bulge_distance is negative

LO_RESULT LORectangleCreateLozenge | ( | LORectangleRef * | rectangle,
|  | const LOAxisAlignedRect2D * | bounds
| ) |  |

Creates a 'Lozenge' rectangle with the shorter side curved.

Parameters

  [out] | rectangle | The rectangle object.
  [in] | bounds | The starting dimensions of the rectangle.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_OUTPUT if rectangle is NULL
  - SU_ERROR_OVERWRITE_VALID if *rectangle already refers to a valid object
  - SU_ERROR_NULL_POINTER_INPUT if bounds is NULL
  - SU_ERROR_OUT_OF_RANGE if bounds has a width or height of zero

LO_RESULT LORectangleCreateRounded | ( | LORectangleRef * | rectangle,
|  | const LOAxisAlignedRect2D * | bounds,
|  | double | corner_radius
| ) |  |

Creates a 'rounded' rectangle with arcs in each corner.

Parameters

  [out] | rectangle | The rectangle object.
  [in] | bounds | The starting dimensions of the rectangle.
  [in] | corner_radius | The radius of the circles in the corners in inches.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_OUTPUT if rectangle is NULL
  - SU_ERROR_OVERWRITE_VALID if *rectangle already refers to a valid object
  - SU_ERROR_NULL_POINTER_INPUT if bounds is NULL
  - SU_ERROR_OUT_OF_RANGE if bounds has a width or height of zero
  - SU_ERROR_OUT_OF_RANGE if corner_radius is negative

LO_EXPORT LORectangleRef LORectangleFromEntity | ( | LOEntityRef | entity | ) |

Converts from a LOEntityRef to a LORectangleRef. This is essentially a downcast operation so the given LOEntityRef must be convertible to a LORectangleRef.

Parameters

  [in] | entity | The entity object.

Returns
  - The converted LORectangleRef if the downcast operation succeeds
  - If not, the returned reference will be invalid

LO_RESULT LORectangleGetBottomLeftPoint | ( | LORectangleRef | rectangle,
|  | LOPoint2D * | point
| ) |  |

Gets the point that was originally defined as the bottom left point. Transforms to this object may have moved it so that it is no longer the bottom left point geometrically on the page.

Parameters

  [in] | rectangle | The rectangle object.
  [out] | point | The position of the original bottom left point.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if rectangle does not refer to a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if point is NULL

LO_RESULT LORectangleGetBottomRightPoint | ( | LORectangleRef | rectangle,
|  | LOPoint2D * | point
| ) |  |

Gets the point that was originally defined as the bottom right point. Transforms to this object may have moved it so that it is no longer the bottom right point geometrically on the page.

Parameters

  [in] | rectangle | The rectangle object.
  [out] | point | The position of the original bottom right point.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if rectangle does not refer to a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if point is NULL

LO_RESULT LORectangleGetRadius | ( | LORectangleRef | rectangle,
|  | double * | radius
| ) |  |

Returns the radius that defines the shape of a bulged or rounded rectangle.

Parameters

  [in] | rectangle | The rectangle object.
  [out] | radius | The radius for bulged and rounded rectangles.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if rectangle does not refer to a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if radius is NULL
  - SU_ERROR_NO_DATA if the rectangle is not of type LORectangleType_Bulged or LORectangleType_Rounded

LO_RESULT LORectangleGetRectangleType | ( | LORectangleRef | rectangle,
|  | LORectangleType * | type
| ) |  |

Gets the type of a rectangle.

Parameters

  [in] | rectangle | The rectangle object.
  [out] | type | The type of the rectangle.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if rectangle does not refer to a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if type is NULL

LO_RESULT LORectangleGetTopLeftPoint | ( | LORectangleRef | rectangle,
|  | LOPoint2D * | point
| ) |  |

Gets the point that was originally defined as the upper left point. Transforms to this object may have moved it so that it is no longer the top left point geometrically on the page.

Parameters

  [in] | rectangle | The rectangle object.
  [out] | point | The position of the original top left point.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if rectangle does not refer to a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if point is NULL

LO_RESULT LORectangleGetTopRightPoint | ( | LORectangleRef | rectangle,
|  | LOPoint2D * | point
| ) |  |

Gets the point that was originally defined as the upper right point. Transforms to this object may have moved it so that it is no longer the top right point geometrically on the page.

Parameters

  [in] | rectangle | The rectangle object.
  [out] | point | The position of the original top right point.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if rectangle does not refer to a valid object
  - SU_ERROR_NULL_POINTER_OUTPUT if point is NULL

LO_RESULT LORectangleRelease | ( | LORectangleRef * | rectangle | ) |

Releases a rectangle object. The object will be invalidated if releasing the last reference.

Parameters

  [in] | rectangle | The rectangle object.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_NULL_POINTER_INPUT if rectangle is NULL
  - SU_ERROR_INVALID_INPUT if *rectangle does not refer to a valid object

LO_RESULT LORectangleSetRadius | ( | LORectangleRef | rectangle,
|  | double | radius
| ) |  |

Sets the radius that defines the shape of a bulged or rounded rectangle.

Parameters

  [in] | rectangle | The rectangle object.
  [out] | radius | The radius for bulged and rounded rectangles.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if rectangle does not refer to a valid object
  - SU_ERROR_NO_DATA if the rectangle is not of type LORectangleType_Bulged or LORectangleType_Rounded
  - SU_ERROR_OUT_OF_RANGE if radius is negative
  - SU_ERROR_LAYER_LOCKED if rectangle is on a locked layer
  - SU_ERROR_ENTITY_LOCKED if rectangle is locked

LO_RESULT LORectangleSetRectangleType | ( | LORectangleRef | rectangle,
|  | LORectangleType | type
| ) |  |

Gets the type of a rectangle.

Parameters

  [in] | rectangle | The rectangle object.
  [in] | type | The type of the rectangle.

Returns
  - SU_ERROR_NONE on success
  - SU_ERROR_INVALID_INPUT if rectangle does not refer to a valid object
  - SU_ERROR_LAYER_LOCKED if rectangle is on a locked layer
  - SU_ERROR_ENTITY_LOCKED if rectangle is locked
  - SU_ERROR_GENERIC if type is not a valid rectangle type

LO_EXPORT LOEntityRef LORectangleToEntity | ( | LORectangleRef | rectangle | ) |

Converts from a LORectangleRef to a LOEntityRef. This is essentially an upcast operation.

Parameters

  [in] | rectangle | The rectangle object.

Returns
  - The converted LOEntityRef if rectangle is a valid object
  - If not, the returned reference will be invalid