|
JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins
« « « Anklang Documentation |
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 (RectangleType rect) | |
| Creates a list containing just one rectangle. | |
| RectangleList & | operator= (const RectangleList &other) |
| Copies this list from another one. | |
| RectangleList (RectangleList &&other) noexcept | |
| Move constructor. | |
| RectangleList & | operator= (RectangleList &&other) noexcept |
| Move assignment operator. | |
| bool | isEmpty () const noexcept |
| Returns true if the region is empty. | |
| 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. | |
| void | clear () |
| Removes all rectangles to leave an empty region. | |
| 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. | |
| void | add (const RectangleList &other) |
| Merges another rectangle list into this one. | |
| void | subtract (const RectangleType rect) |
| Removes a rectangular region from the list. | |
| bool | subtract (const RectangleList &otherList) |
| Removes all areas in another RectangleList from this one. | |
| bool | clipTo (RectangleType rect) |
| Removes any areas of the region that lie outside a given rectangle. | |
| template<typename OtherValueType > | |
| bool | clipTo (const RectangleList< OtherValueType > &other) |
| Removes any areas of the region that lie outside a given rectangle list. | |
| bool | getIntersectionWith (RectangleType rect, RectangleList &destRegion) const |
| Creates a region which is the result of clipping this one to a given rectangle. | |
| void | swapWith (RectangleList &otherList) noexcept |
| Swaps the contents of this and another list. | |
| 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. | |
| bool | intersectsRectangle (RectangleType rectangleToCheck) const noexcept |
| Checks whether the region contains any part of a given rectangle. | |
| bool | intersects (const RectangleList &other) const noexcept |
| Checks whether this region intersects any part of another one. | |
| RectangleType | getBounds () const noexcept |
| Returns the smallest rectangle that can enclose the whole of this region. | |
| void | consolidate () |
| Optimises the list into a minimum number of constituent rectangles. | |
| 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. | |
| template<typename ScaleType > | |
| void | scaleAll (ScaleType scaleFactor) noexcept |
| Scales all the coordinates. | |
| void | transformAll (const AffineTransform &transform) noexcept |
| Applies a transform to all the rectangles. | |
| Path | toPath () const |
| Creates a Path object to represent this region. | |
| const RectangleType * | begin () const noexcept |
| Standard method for iterating the rectangles in the list. | |
| 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. | |
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}
Definition at line 42 of file juce_RectangleList.h.
| using juce::RectangleList< ValueType >::RectangleType = Rectangle<ValueType> |
Definition at line 45 of file juce_RectangleList.h.
| juce::RectangleList< ValueType >::RectangleList | ( | const RectangleList< ValueType > & | other | ) |
Creates a copy of another list.
Definition at line 52 of file juce_RectangleList.h.
| juce::RectangleList< ValueType >::RectangleList | ( | RectangleType | rect | ) |
Creates a list containing just one rectangle.
Definition at line 57 of file juce_RectangleList.h.
|
noexcept |
Move constructor.
Definition at line 70 of file juce_RectangleList.h.
| void juce::RectangleList< ValueType >::add | ( | const RectangleList< ValueType > & | other | ) |
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.
Definition at line 193 of file juce_RectangleList.h.
| void juce::RectangleList< ValueType >::add | ( | RectangleType | rect | ) |
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.
Definition at line 110 of file juce_RectangleList.h.
| void juce::RectangleList< ValueType >::add | ( | ValueType | x, |
| ValueType | y, | ||
| ValueType | width, | ||
| ValueType | height | ||
| ) |
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.
Definition at line 167 of file juce_RectangleList.h.
| void juce::RectangleList< ValueType >::addWithoutMerging | ( | RectangleType | rect | ) |
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.
Definition at line 180 of file juce_RectangleList.h.
|
noexcept |
Standard method for iterating the rectangles in the list.
Definition at line 665 of file juce_RectangleList.h.
| void juce::RectangleList< ValueType >::clear | ( | ) |
Removes all rectangles to leave an empty region.
Definition at line 96 of file juce_RectangleList.h.
| bool juce::RectangleList< ValueType >::clipTo | ( | const RectangleList< OtherValueType > & | other | ) |
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.
Definition at line 382 of file juce_RectangleList.h.
| bool juce::RectangleList< ValueType >::clipTo | ( | RectangleType | rect | ) |
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.
Definition at line 346 of file juce_RectangleList.h.
| void juce::RectangleList< ValueType >::consolidate | ( | ) |
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.
Definition at line 549 of file juce_RectangleList.h.
|
noexcept |
Checks whether the region contains a given point.
Definition at line 441 of file juce_RectangleList.h.
|
noexcept |
Checks whether the region contains a given point.
Definition at line 453 of file juce_RectangleList.h.
| bool juce::RectangleList< ValueType >::containsRectangle | ( | RectangleType | rectangleToCheck | ) | const |
Checks whether the region contains the whole of a given rectangle.
Definition at line 464 of file juce_RectangleList.h.
|
noexcept |
Standard method for iterating the rectangles in the list.
Definition at line 667 of file juce_RectangleList.h.
| void juce::RectangleList< ValueType >::ensureStorageAllocated | ( | int | minNumRectangles | ) |
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.
Definition at line 675 of file juce_RectangleList.h.
|
noexcept |
Returns the smallest rectangle that can enclose the whole of this region.
Definition at line 515 of file juce_RectangleList.h.
| bool juce::RectangleList< ValueType >::getIntersectionWith | ( | RectangleType | rect, |
| RectangleList< ValueType > & | destRegion | ||
| ) | const |
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.
Definition at line 413 of file juce_RectangleList.h.
|
noexcept |
Returns the number of rectangles in the list.
Definition at line 87 of file juce_RectangleList.h.
|
noexcept |
Returns one of the rectangles at a particular index.
Definition at line 92 of file juce_RectangleList.h.
|
noexcept |
Checks whether this region intersects any part of another one.
Definition at line 504 of file juce_RectangleList.h.
|
noexcept |
Checks whether the region contains any part of a given rectangle.
Definition at line 492 of file juce_RectangleList.h.
|
noexcept |
Returns true if the region is empty.
Definition at line 84 of file juce_RectangleList.h.
|
noexcept |
Adds an x and y value to all the coordinates.
Definition at line 621 of file juce_RectangleList.h.
|
noexcept |
Adds an x and y value to all the coordinates.
Definition at line 628 of file juce_RectangleList.h.
| RectangleList & juce::RectangleList< ValueType >::operator= | ( | const RectangleList< ValueType > & | other | ) |
Copies this list from another one.
Definition at line 63 of file juce_RectangleList.h.
|
noexcept |
Move assignment operator.
Definition at line 76 of file juce_RectangleList.h.
|
noexcept |
Scales all the coordinates.
Definition at line 635 of file juce_RectangleList.h.
| bool juce::RectangleList< ValueType >::subtract | ( | const RectangleList< ValueType > & | otherList | ) |
Removes all areas in another RectangleList from this one.
Any rectangles in the list which overlap this will be clipped and subdivided if necessary.
Definition at line 324 of file juce_RectangleList.h.
| void juce::RectangleList< ValueType >::subtract | ( | const RectangleType | rect | ) |
Removes a rectangular region from the list.
Any rectangles in the list which overlap this will be clipped and subdivided if necessary.
Definition at line 204 of file juce_RectangleList.h.
|
noexcept |
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.
Definition at line 432 of file juce_RectangleList.h.
| Path juce::RectangleList< ValueType >::toPath | ( | ) | const |
Creates a Path object to represent this region.
Definition at line 653 of file juce_RectangleList.h.
|
noexcept |
Applies a transform to all the rectangles.
Obviously this will create a mess if the transform involves any rotation or skewing.
Definition at line 645 of file juce_RectangleList.h.