Maintains a set of rectangles as a complex region. More...
#include <juce_RectangleList.h>
Public Types | |
using | RectangleType = Rectangle< ValueType > |
Public Member Functions | |
RectangleList () noexcept | |
Creates an empty RectangleList. More... | |
RectangleList (const RectangleList &other) | |
Creates a copy of another list. More... | |
RectangleList (RectangleType rect) | |
Creates a list containing just one rectangle. More... | |
RectangleList (RectangleList &&other) noexcept | |
Move constructor. More... | |
void | add (RectangleType rect) |
Merges a new rectangle into the list. More... | |
void | add (ValueType x, ValueType y, ValueType width, ValueType height) |
Merges a new rectangle into the list. More... | |
void | add (const RectangleList &other) |
Merges another rectangle list into this one. More... | |
void | addWithoutMerging (RectangleType rect) |
Dumbly adds a rectangle to the list without checking for overlaps. More... | |
const RectangleType * | begin () const noexcept |
Standard method for iterating the rectangles in the list. More... | |
void | clear () |
Removes all rectangles to leave an empty region. More... | |
bool | clipTo (RectangleType rect) |
Removes any areas of the region that lie outside a given rectangle. More... | |
template<typename OtherValueType > | |
bool | clipTo (const RectangleList< OtherValueType > &other) |
Removes any areas of the region that lie outside a given rectangle list. More... | |
void | consolidate () |
Optimises the list into a minimum number of constituent rectangles. More... | |
bool | containsPoint (Point< ValueType > point) const noexcept |
Checks whether the region contains a given point. More... | |
bool | containsPoint (ValueType x, ValueType y) const noexcept |
Checks whether the region contains a given point. More... | |
bool | containsRectangle (RectangleType rectangleToCheck) const |
Checks whether the region contains the whole of a given rectangle. More... | |
const RectangleType * | end () const noexcept |
Standard method for iterating the rectangles in the list. More... | |
void | ensureStorageAllocated (int minNumRectangles) |
Increases the internal storage to hold a minimum number of rectangles. More... | |
RectangleType | getBounds () const noexcept |
Returns the smallest rectangle that can enclose the whole of this region. More... | |
bool | getIntersectionWith (RectangleType rect, RectangleList &destRegion) const |
Creates a region which is the result of clipping this one to a given rectangle. More... | |
int | getNumRectangles () const noexcept |
Returns the number of rectangles in the list. More... | |
RectangleType | getRectangle (int index) const noexcept |
Returns one of the rectangles at a particular index. More... | |
bool | intersects (const RectangleList &other) const noexcept |
Checks whether this region intersects any part of another one. More... | |
bool | intersectsRectangle (RectangleType rectangleToCheck) const noexcept |
Checks whether the region contains any part of a given rectangle. More... | |
bool | isEmpty () const noexcept |
Returns true if the region is empty. More... | |
void | offsetAll (Point< ValueType > offset) noexcept |
Adds an x and y value to all the coordinates. More... | |
void | offsetAll (ValueType dx, ValueType dy) noexcept |
Adds an x and y value to all the coordinates. More... | |
RectangleList & | operator= (const RectangleList &other) |
Copies this list from another one. More... | |
RectangleList & | operator= (RectangleList &&other) noexcept |
Move assignment operator. More... | |
template<typename ScaleType > | |
void | scaleAll (ScaleType scaleFactor) noexcept |
Scales all the coordinates. More... | |
void | subtract (RectangleType rect) |
Removes a rectangular region from the list. More... | |
bool | subtract (const RectangleList &otherList) |
Removes all areas in another RectangleList from this one. More... | |
void | swapWith (RectangleList &otherList) noexcept |
Swaps the contents of this and another list. More... | |
Path | toPath () const |
Creates a Path object to represent this region. More... | |
void | transformAll (const AffineTransform &transform) noexcept |
Applies a transform to all the rectangles. More... | |
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.
{Graphics}
using juce::RectangleList< ValueType >::RectangleType = Rectangle<ValueType> |
|
inlinenoexcept |
Creates an empty RectangleList.
|
inline |
Creates a copy of another list.
|
inline |
Creates a list containing just one rectangle.
|
inlinenoexcept |
Move constructor.
|
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.
Referenced by juce::RectangleList< int >::add(), and juce::RenderingHelpers::SavedStateBase< SoftwareRendererSavedState >::clipToRectangleList().
|
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.
|
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.
|
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.
Referenced by juce::RectangleList< int >::RectangleList().
|
inlinenoexcept |
Standard method for iterating the rectangles in the list.
Referenced by juce::RenderingHelpers::SavedStateBase< SoftwareRendererSavedState >::fillRectList().
|
inline |
Removes all rectangles to leave an empty region.
Referenced by juce::RectangleList< int >::clipTo(), and juce::RectangleList< int >::getIntersectionWith().
|
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.
|
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.
|
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.
|
inlinenoexcept |
Checks whether the region contains a given point.
Referenced by juce::RectangleList< int >::containsPoint().
|
inlinenoexcept |
Checks whether the region contains a given point.
|
inline |
Checks whether the region contains the whole of a given rectangle.
|
inlinenoexcept |
Standard method for iterating the rectangles in the list.
|
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.
|
inlinenoexcept |
Returns the smallest rectangle that can enclose the whole of this region.
|
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.
|
inlinenoexcept |
Returns the number of rectangles in the list.
Referenced by juce::RenderingHelpers::SavedStateBase< SoftwareRendererSavedState >::fillRectList().
|
inlinenoexcept |
Returns one of the rectangles at a particular index.
|
inlinenoexcept |
Checks whether this region intersects any part of another one.
|
inlinenoexcept |
Checks whether the region contains any part of a given rectangle.
|
inlinenoexcept |
Returns true if the region is empty.
Referenced by juce::RectangleList< int >::add(), juce::RectangleList< int >::clipTo(), juce::RenderingHelpers::ClipRegions< SavedStateType >::EdgeTableRegion::clipToRectangleList(), juce::RectangleList< int >::containsRectangle(), juce::RectangleList< int >::getBounds(), juce::RectangleList< int >::getIntersectionWith(), and juce::RectangleList< int >::subtract().
|
inlinenoexcept |
Adds an x and y value to all the coordinates.
Referenced by juce::RenderingHelpers::SavedStateBase< SoftwareRendererSavedState >::clipToRectangleList(), juce::RenderingHelpers::SavedStateBase< SoftwareRendererSavedState >::fillRectList(), and juce::RectangleList< int >::offsetAll().
|
inlinenoexcept |
Adds an x and y value to all the coordinates.
|
inline |
Copies this list from another one.
|
inlinenoexcept |
Move assignment operator.
|
inlinenoexcept |
Scales all the coordinates.
|
inline |
Removes a rectangular region from the list.
Any rectangles in the list which overlap this will be clipped and subdivided if necessary.
Referenced by juce::RectangleList< int >::add(), juce::RectangleList< int >::containsRectangle(), and juce::RectangleList< int >::subtract().
|
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.
|
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.
Referenced by juce::RectangleList< int >::clipTo().
|
inline |
Creates a Path object to represent this region.
Referenced by juce::RenderingHelpers::SavedStateBase< SoftwareRendererSavedState >::clipToRectangleList(), and juce::RenderingHelpers::SavedStateBase< SoftwareRendererSavedState >::fillRectList().
|
inlinenoexcept |
Applies a transform to all the rectangles.
Obviously this will create a mess if the transform involves any rotation or skewing.
Referenced by juce::RenderingHelpers::SavedStateBase< SoftwareRendererSavedState >::fillRectList().
|
private |
Referenced by juce::RectangleList< int >::add(), juce::RectangleList< int >::addWithoutMerging(), juce::RectangleList< int >::begin(), juce::RectangleList< int >::clear(), juce::RectangleList< int >::clipTo(), juce::RectangleList< int >::consolidate(), juce::RectangleList< int >::containsPoint(), juce::RectangleList< int >::containsRectangle(), juce::RectangleList< int >::end(), juce::RectangleList< int >::ensureStorageAllocated(), juce::RectangleList< int >::getBounds(), juce::RectangleList< int >::getIntersectionWith(), juce::RectangleList< int >::getNumRectangles(), juce::RectangleList< int >::getRectangle(), juce::RectangleList< int >::intersects(), juce::RectangleList< int >::intersectsRectangle(), juce::RectangleList< int >::isEmpty(), juce::RectangleList< int >::offsetAll(), juce::RectangleList< int >::operator=(), juce::RectangleList< int >::scaleAll(), juce::RectangleList< int >::subtract(), juce::RectangleList< int >::swapWith(), juce::RectangleList< int >::toPath(), and juce::RectangleList< int >::transformAll().