Maintains a set of rectangles as a complex region. More...
#include <juce_RectangleList.h>


Public Types | |
| using | RectangleType = Rectangle< ValueType > |
Public Member Functions | |
| RectangleList ()=default | |
| Creates an empty RectangleList. | |
| RectangleList (const RectangleList &other) | |
| Creates a copy of another list. | |
| RectangleList (RectangleList &&other) noexcept | |
| Move constructor. | |
| RectangleList (RectangleType rect) | |
| Creates a list containing just one rectangle. | |
| void | add (const RectangleList &other) |
| Merges another rectangle list into this one. | |
| void | add (RectangleType rect) |
| Merges a new rectangle into the list. | |
| void | add (ValueType x, ValueType y, ValueType width, ValueType height) |
| Merges a new rectangle into the list. | |
| void | addWithoutMerging (RectangleType rect) |
| Dumbly adds a rectangle to the list without checking for overlaps. | |
| const RectangleType * | begin () const noexcept |
| Standard method for iterating the rectangles in the list. | |
| void | clear () |
| Removes all rectangles to leave an empty region. | |
| template<typename OtherValueType > | |
| bool | clipTo (const RectangleList< OtherValueType > &other) |
| Removes any areas of the region that lie outside a given rectangle list. | |
| bool | clipTo (RectangleType rect) |
| Removes any areas of the region that lie outside a given rectangle. | |
| void | consolidate () |
| Optimises the list into a minimum number of constituent rectangles. | |
| bool | containsPoint (Point< ValueType > point) const noexcept |
| Checks whether the region contains a given point. | |
| bool | containsPoint (ValueType x, ValueType y) const noexcept |
| Checks whether the region contains a given point. | |
| bool | containsRectangle (RectangleType rectangleToCheck) const |
| Checks whether the region contains the whole of a given rectangle. | |
| const RectangleType * | end () const noexcept |
| Standard method for iterating the rectangles in the list. | |
| void | ensureStorageAllocated (int minNumRectangles) |
| Increases the internal storage to hold a minimum number of rectangles. | |
| RectangleType | getBounds () const noexcept |
| Returns the smallest rectangle that can enclose the whole of this region. | |
| bool | getIntersectionWith (RectangleType rect, RectangleList &destRegion) const |
| Creates a region which is the result of clipping this one to a given rectangle. | |
| int | getNumRectangles () const noexcept |
| Returns the number of rectangles in the list. | |
| RectangleType | getRectangle (int index) const noexcept |
| Returns one of the rectangles at a particular index. | |
| bool | intersects (const RectangleList &other) const noexcept |
| Checks whether this region intersects any part of another one. | |
| bool | intersectsRectangle (RectangleType rectangleToCheck) const noexcept |
| Checks whether the region contains any part of a given rectangle. | |
| bool | isEmpty () const noexcept |
| Returns true if the region is empty. | |
| void | offsetAll (Point< ValueType > offset) noexcept |
| Adds an x and y value to all the coordinates. | |
| void | offsetAll (ValueType dx, ValueType dy) noexcept |
| Adds an x and y value to all the coordinates. | |
| RectangleList & | operator= (const RectangleList &other) |
| Copies this list from another one. | |
| RectangleList & | operator= (RectangleList &&other) noexcept |
| Move assignment operator. | |
| template<typename ScaleType > | |
| void | scaleAll (ScaleType scaleFactor) noexcept |
| Scales all the coordinates. | |
| bool | subtract (const RectangleList &otherList) |
| Removes all areas in another RectangleList from this one. | |
| void | subtract (const RectangleType rect) |
| Removes a rectangular region from the list. | |
| void | swapWith (RectangleList &otherList) noexcept |
| Swaps the contents of this and another list. | |
| Path | toPath () const |
| Creates a Path object to represent this region. | |
| void | transformAll (const AffineTransform &transform) noexcept |
| Applies a transform to all the rectangles. | |
Private Attributes | |
| Array< RectangleType > | rects |
Maintains a set of rectangles as a complex region.
This class allows a set of rectangles to be treated as a solid shape, and can add and remove rectangular sections of it, and simplify overlapping or adjacent rectangles.
@tags{Graphics}
| using juce::RectangleList< ValueType >::RectangleType = Rectangle<ValueType> |
|
default |
Creates an empty RectangleList.
|
inline |
Creates a copy of another list.
|
inline |
Creates a list containing just one rectangle.
References juce::RectangleList< ValueType >::addWithoutMerging().
|
inlinenoexcept |
Move constructor.
|
inline |
Merges another rectangle list into this one.
Any overlaps between the two lists will be clipped, so that the result is the union of both lists.
References juce::RectangleList< ValueType >::add().
|
inline |
Merges a new rectangle into the list.
The rectangle being added will first be clipped to remove any parts of it that overlap existing rectangles in the list, and adjacent rectangles will be merged into it.
The rectangle can have any size and may be empty, but if it's floating point then it's expected to not contain any INF values.
References juce::Rectangle< ValueType >::contains(), juce::Rectangle< ValueType >::intersects(), juce::Rectangle< ValueType >::isEmpty(), juce::RectangleList< ValueType >::isEmpty(), juce::Rectangle< ValueType >::isFinite(), jassert, and juce::RectangleList< ValueType >::rects.
Referenced by juce::RectangleList< ValueType >::add(), juce::RectangleList< ValueType >::add(), juce::Direct2DGraphicsContext::PendingClipList::clipTo(), and juce::CoreGraphicsMetalLayerRenderer::drawRectangleList().
|
inline |
Merges a new rectangle into the list.
The rectangle being added will first be clipped to remove any parts of it that overlap existing rectangles in the list.
References juce::RectangleList< ValueType >::add().
|
inline |
Dumbly adds a rectangle to the list without checking for overlaps.
This simply adds the rectangle to the end, it doesn't merge it or remove any overlapping bits.
The rectangle can have any size and may be empty, but if it's floating point then it's expected to not contain any INF values.
References juce::Rectangle< ValueType >::isEmpty(), juce::Rectangle< ValueType >::isFinite(), jassert, and juce::RectangleList< ValueType >::rects.
Referenced by juce::RectangleList< ValueType >::RectangleList(), and juce::LowLevelGraphicsContext::drawRect().
|
inlinenoexcept |
Standard method for iterating the rectangles in the list.
References juce::RectangleList< ValueType >::rects.
|
inline |
Removes all rectangles to leave an empty region.
References juce::RectangleList< ValueType >::rects.
Referenced by juce::Direct2DGraphicsContext::PendingClipList::clipTo(), juce::RectangleList< ValueType >::clipTo(), juce::CoreGraphicsMetalLayerRenderer::drawRectangleList(), juce::RectangleList< ValueType >::getIntersectionWith(), juce::detail::StandardCachedComponentImage::invalidateAll(), and juce::detail::StandardCachedComponentImage::paint().
|
inline |
Removes any areas of the region that lie outside a given rectangle list.
Any rectangles in this object which overlap the specified list will be clipped and subdivided if necessary.
Returns true if the resulting region is not empty, false if it is empty.
References juce::RectangleList< ValueType >::isEmpty(), juce::RectangleList< ValueType >::rects, and juce::RectangleList< ValueType >::swapWith().
|
inline |
Removes any areas of the region that lie outside a given rectangle.
Any rectangles in the list which overlap this will be clipped and subdivided if necessary.
Returns true if the resulting region is not empty, false if it is empty.
References juce::RectangleList< ValueType >::clear(), juce::Rectangle< ValueType >::intersectRectangle(), juce::Rectangle< ValueType >::isEmpty(), juce::Rectangle< ValueType >::isFinite(), jassert, and juce::RectangleList< ValueType >::rects.
Referenced by juce::Direct2DGraphicsContext::PendingClipList::clipTo(), juce::Direct2DGraphicsContext::PendingClipList::clipTo(), juce::RenderingHelpers::ClipRegions::RectangleListRegion< SavedStateType >::clipToRectangle(), and juce::RenderingHelpers::ClipRegions::RectangleListRegion< SavedStateType >::clipToRectangleList().
|
inline |
Optimises the list into a minimum number of constituent rectangles.
This will try to combine any adjacent rectangles into larger ones where possible, to simplify lists that might have been fragmented by repeated add/subtract calls.
References juce::RectangleList< ValueType >::rects.
|
inlinenoexcept |
Checks whether the region contains a given point.
References juce::RectangleList< ValueType >::rects.
Referenced by juce::RectangleList< ValueType >::containsPoint().
|
inlinenoexcept |
Checks whether the region contains a given point.
References juce::RectangleList< ValueType >::containsPoint().
|
inline |
Checks whether the region contains the whole of a given rectangle.
References juce::RectangleList< ValueType >::isEmpty(), and juce::RectangleList< ValueType >::rects.
Referenced by juce::detail::StandardCachedComponentImage::paint().
|
inlinenoexcept |
Standard method for iterating the rectangles in the list.
References juce::RectangleList< ValueType >::rects.
|
inline |
Increases the internal storage to hold a minimum number of rectangles.
Calling this before adding a large number of rectangles means that the array won't have to keep dynamically resizing itself as the elements are added, and it'll therefore be more efficient.
References juce::RectangleList< ValueType >::rects.
|
inlinenoexcept |
Returns the smallest rectangle that can enclose the whole of this region.
References juce::RectangleList< ValueType >::isEmpty(), juce::jmax(), juce::jmin(), and juce::RectangleList< ValueType >::rects.
Referenced by juce::RenderingHelpers::ClipRegions::RectangleListRegion< SavedStateType >::getClipBounds().
|
inline |
Creates a region which is the result of clipping this one to a given rectangle.
Unlike the other clipTo method, this one doesn't affect this object - it puts the resulting region into the list whose reference is passed-in.
Returns true if the resulting region is not empty, false if it is empty.
References juce::RectangleList< ValueType >::clear(), juce::Rectangle< ValueType >::intersectRectangle(), juce::Rectangle< ValueType >::isEmpty(), juce::RectangleList< ValueType >::isEmpty(), juce::Rectangle< ValueType >::isFinite(), jassert, and juce::RectangleList< ValueType >::rects.
|
inlinenoexcept |
Returns the number of rectangles in the list.
References juce::RectangleList< ValueType >::rects.
Referenced by juce::UIATextProvider::UIATextRangeProvider::GetBoundingRectangles().
|
inlinenoexcept |
Returns one of the rectangles at a particular index.
References juce::RectangleList< ValueType >::rects.
|
inlinenoexcept |
Checks whether this region intersects any part of another one.
References juce::RectangleList< ValueType >::rects.
Referenced by juce::RenderingHelpers::ClipRegions::RectangleListRegion< SavedStateType >::clipRegionIntersects().
|
inlinenoexcept |
Checks whether the region contains any part of a given rectangle.
References juce::RectangleList< ValueType >::rects.
|
inlinenoexcept |
Returns true if the region is empty.
References juce::RectangleList< ValueType >::rects.
Referenced by juce::RectangleList< ValueType >::add(), juce::RectangleList< ValueType >::clipTo(), juce::RenderingHelpers::ClipRegions::RectangleListRegion< SavedStateType >::clipToRectangle(), juce::RenderingHelpers::ClipRegions::RectangleListRegion< SavedStateType >::clipToRectangleList(), juce::RectangleList< ValueType >::containsRectangle(), juce::RenderingHelpers::ClipRegions::RectangleListRegion< SavedStateType >::excludeClipRectangle(), juce::RectangleList< ValueType >::getBounds(), juce::RectangleList< ValueType >::getIntersectionWith(), and juce::RectangleList< ValueType >::subtract().
|
inlinenoexcept |
Adds an x and y value to all the coordinates.
References juce::RectangleList< ValueType >::rects.
Referenced by juce::RenderingHelpers::SavedStateBase< SavedStateType >::clipToRectangleList(), juce::RenderingHelpers::SavedStateBase< SavedStateType >::fillRectList(), juce::RectangleList< ValueType >::offsetAll(), and juce::RenderingHelpers::ClipRegions::RectangleListRegion< SavedStateType >::translate().
|
inlinenoexcept |
Adds an x and y value to all the coordinates.
References juce::RectangleList< ValueType >::offsetAll().
|
inline |
Copies this list from another one.
References juce::RectangleList< ValueType >::rects.
|
inlinenoexcept |
Move assignment operator.
References juce::RectangleList< ValueType >::rects.
|
inlinenoexcept |
Scales all the coordinates.
References juce::RectangleList< ValueType >::rects.
|
inline |
Removes all areas in another RectangleList from this one.
Any rectangles in the list which overlap this will be clipped and subdivided if necessary.
References juce::RectangleList< ValueType >::isEmpty(), and juce::RectangleList< ValueType >::subtract().
|
inline |
Removes a rectangular region from the list.
Any rectangles in the list which overlap this will be clipped and subdivided if necessary.
References juce::Rectangle< ValueType >::getHeight(), juce::Rectangle< ValueType >::getWidth(), juce::Rectangle< ValueType >::getX(), juce::Rectangle< ValueType >::getY(), juce::ignoreUnused(), and juce::RectangleList< ValueType >::rects.
Referenced by juce::RenderingHelpers::ClipRegions::EdgeTableRegion< SavedStateType >::clipToRectangleList(), juce::RenderingHelpers::ClipRegions::RectangleListRegion< SavedStateType >::excludeClipRectangle(), juce::detail::StandardCachedComponentImage::invalidate(), juce::RectangleList< ValueType >::subtract(), and juce::Direct2DGraphicsContext::PendingClipList::subtract().
|
inlinenoexcept |
Swaps the contents of this and another list.
This swaps their internal pointers, so is hugely faster than using copy-by-value to swap them.
References juce::RectangleList< ValueType >::rects.
Referenced by juce::RectangleList< ValueType >::clipTo().
|
inline |
Creates a Path object to represent this region.
References juce::RectangleList< ValueType >::rects.
|
inlinenoexcept |
Applies a transform to all the rectangles.
Obviously this will create a mess if the transform involves any rotation or skewing.
References juce::RectangleList< ValueType >::rects.
Referenced by juce::RenderingHelpers::SavedStateBase< SavedStateType >::fillRectList().
|
private |
Referenced by juce::RectangleList< ValueType >::add(), juce::RectangleList< ValueType >::addWithoutMerging(), juce::RectangleList< ValueType >::begin(), juce::RectangleList< ValueType >::clear(), juce::RectangleList< ValueType >::clipTo(), juce::RectangleList< ValueType >::clipTo(), juce::RectangleList< ValueType >::consolidate(), juce::RectangleList< ValueType >::containsPoint(), juce::RectangleList< ValueType >::containsRectangle(), juce::RectangleList< ValueType >::end(), juce::RectangleList< ValueType >::ensureStorageAllocated(), juce::RectangleList< ValueType >::getBounds(), juce::RectangleList< ValueType >::getIntersectionWith(), juce::RectangleList< ValueType >::getNumRectangles(), juce::RectangleList< ValueType >::getRectangle(), juce::RectangleList< ValueType >::intersects(), juce::RectangleList< ValueType >::intersectsRectangle(), juce::RectangleList< ValueType >::isEmpty(), juce::RectangleList< ValueType >::offsetAll(), juce::RectangleList< ValueType >::operator=(), juce::RectangleList< ValueType >::operator=(), juce::RectangleList< ValueType >::scaleAll(), juce::RectangleList< ValueType >::subtract(), juce::RectangleList< ValueType >::swapWith(), juce::RectangleList< ValueType >::toPath(), and juce::RectangleList< ValueType >::transformAll().