A drawable object which acts as a container for a set of other Drawables. More...
Public Member Functions | |
| DrawableComposite ()=default | |
| Creates a composite Drawable. | |
| DrawableComposite (const DrawableComposite &) | |
| Creates a copy of a DrawableComposite. | |
| void | setBoundingBox (Parallelogram< float > newBoundingBox) |
| Sets the parallelogram that defines the target position of the content rectangle when the drawable is rendered. | |
| void | setBoundingBox (Rectangle< float > newBoundingBox) |
| Sets the rectangle that defines the target position of the content rectangle when the drawable is rendered. | |
| Parallelogram< float > | getBoundingBox () const noexcept |
| Returns the parallelogram that defines the target position of the content rectangle when the drawable is rendered. | |
| void | resetBoundingBoxToContentArea () |
| Changes the bounding box transform to match the content area, so that any sub-items will be drawn at their untransformed positions. | |
| Rectangle< float > | getContentArea () const noexcept |
| Returns the main content rectangle. | |
| void | setContentArea (Rectangle< float > newArea) |
| Changes the main content area. | |
| void | resetContentAreaAndBoundingBoxToFitChildren () |
| Resets the content area and the bounding transform to fit around the area occupied by the child components. | |
| bool | replaceColour (Colour originalColour, Colour replacementColour) override |
| Recursively replaces a colour that might be used for filling or stroking. | |
| bool | hitTest (Point< float > p) const override |
| Tests whether a given point is inside the Drawable. | |
| void | addChild (std::unique_ptr< Drawable > newChild) |
| Adds a child Drawable to this one. | |
| int | getNumChildren () const |
| Returns the number of child Drawables that this composite contains. | |
| Drawable & | getChild (int index) |
| const Drawable & | getChild (int index) const |
| Returns a child Drawable by its index. | |
| void | setBlendMode (BlendMode newBlendMode) |
| void | setLuminanceMask (bool isMask) |
| void | setOpacity (float newOpacity) |
| std::unique_ptr< Drawable > | createCopy () const override |
| Creates a deep copy of this Drawable object. | |
| Rectangle< float > | getDrawableBoundsUntransformed () const override |
| Returns the area that this drawable covers in its original coordinate system. | |
| Rectangle< float > | getContentBoundsUntransformed () const override |
| Returns the area that this drawable is intended to occupy in its original coordinate system. | |
| Path | getOutlineAsPath () const override |
| Creates a path that describes the outline of this drawable. | |
Public Member Functions inherited from juce::Drawable | |
| Drawable ()=default | |
| Constructor. | |
| Drawable (const Drawable &other) | |
| Copy constructor. | |
| virtual | ~Drawable ()=default |
| Destructor. | |
| void | draw (Graphics &g, float opacity, const AffineTransform &transform=AffineTransform()) const |
| Renders this Drawable object. | |
| void | drawAt (Graphics &g, float x, float y, float opacity) const |
| Renders the Drawable at a given offset within the Graphics context. | |
| void | drawWithin (Graphics &g, Rectangle< float > destArea, RectanglePlacement placement, float opacity) const |
| Renders the Drawable within a rectangle, scaling it to fit neatly inside without changing its aspect-ratio. | |
| void | setClipPath (std::unique_ptr< Drawable > drawableClipPath) |
| Sets a the clipping region of this drawable using another drawable. | |
| Rectangle< float > | getDrawableBounds () const |
| Returns the area that this drawable covers. | |
| Rectangle< float > | getContentBounds () const |
| Returns the bounds that this drawable is intended to occupy. | |
| int | getWidth () const |
| Returns the width of the drawable bounds rounded up to the nearest integer. | |
| int | getHeight () const |
| Returns the height of the drawable bounds rounded up to the nearest integer. | |
| void | setDrawableTransform (const AffineTransform &transform) |
| Sets a transformation that applies to the same coordinate system in which the rest of the draw calls are made. | |
| void | setDrawableTransformToFit (const Rectangle< float > &area, RectanglePlacement placement) |
| Calls setDrawableTransform() with a transform that will position this Drawable within the specified area in the untransformed coordinate system of the Drawable. | |
| AffineTransform | getDrawableTransform () const |
| Returns the transform that is currently being applied to this drawable. | |
| const String & | getName () const |
| Returns the name of this Drawable object. | |
| void | setName (const String &newName) |
| Sets the name of this drawable object. | |
| void | addListener (Listener *newListener) |
| Adds a listener. | |
| void | removeListener (Listener *listenerToRemove) |
| Removes a listener. | |
| virtual bool | isImage () const |
| virtual std::optional< String > | getContainedText () const |
Additional Inherited Members | |
Static Public Member Functions inherited from juce::Drawable | |
| static std::unique_ptr< Drawable > | createFromImageData (const void *data, size_t numBytes) |
| Tries to turn some kind of image file into a drawable. | |
| static std::unique_ptr< Drawable > | createFromImageDataStream (InputStream &dataSource) |
| Tries to turn a stream containing some kind of image data into a drawable. | |
| static std::unique_ptr< Drawable > | createFromImageFile (const File &file) |
| Tries to turn a file containing some kind of image data into a drawable. | |
| static std::unique_ptr< Drawable > | createFromSVGFile (const File &svgFile) |
| Attempts to parse an SVG (Scalable Vector Graphics) document from a file, and to turn this into a Drawable tree. | |
| static std::unique_ptr< DrawableComposite > | createFromSVGString (const String &svgString) |
| Attempts to parse an SVG (Scalable Vector Graphics) document from a string, and to turn this into a Drawable tree. | |
| static Path | parseSVGPath (const String &svgPath) |
| Parses an SVG path string and returns it. | |
Protected Member Functions inherited from juce::Drawable | |
| virtual AffineTransform | getTransform () const |
| void | callListeners () |
A drawable object which acts as a container for a set of other Drawables.
Note that although this is a Component, it takes ownership of its child components and will delete them, so that you can use it as a self-contained graphic object. The intention is that you should not add your own components to it, only add other Drawable objects.
|
default |
Creates a composite Drawable.
| juce::DrawableComposite::DrawableComposite | ( | const DrawableComposite & | ) |
Creates a copy of a DrawableComposite.
| void juce::DrawableComposite::setBoundingBox | ( | Parallelogram< float > | newBoundingBox | ) |
Sets the parallelogram that defines the target position of the content rectangle when the drawable is rendered.
Sets the rectangle that defines the target position of the content rectangle when the drawable is rendered.
|
inlinenoexcept |
Returns the parallelogram that defines the target position of the content rectangle when the drawable is rendered.
| void juce::DrawableComposite::resetBoundingBoxToContentArea | ( | ) |
Changes the bounding box transform to match the content area, so that any sub-items will be drawn at their untransformed positions.
Returns the main content rectangle.
Changes the main content area.
| void juce::DrawableComposite::resetContentAreaAndBoundingBoxToFitChildren | ( | ) |
Resets the content area and the bounding transform to fit around the area occupied by the child components.
|
overridevirtual |
Recursively replaces a colour that might be used for filling or stroking.
return true if any instances of this colour were found.
Reimplemented from juce::Drawable.
Tests whether a given point is inside the Drawable.
Implements juce::Drawable.
Adds a child Drawable to this one.
|
inline |
Returns the number of child Drawables that this composite contains.
References juce::isPositiveAndBelow(), and jassert.
Returns a child Drawable by its index.
References juce::isPositiveAndBelow(), and jassert.
|
overridevirtual |
Creates a deep copy of this Drawable object.
Use this to create a new copy of this and any sub-objects in the tree.
Implements juce::Drawable.
|
overridevirtual |
Returns the area that this drawable covers in its original coordinate system.
These bounds are not affected by setDrawableTransform().
Implements juce::Drawable.
Returns the area that this drawable is intended to occupy in its original coordinate system.
These bounds are not affected by setDrawableTransform().
A DrawableComposite will return the value of getContentArea(), while the base implementation will return the value of getDrawableBounds().
Consequently, a Drawable parsed from an SVG file will return the SVG viewBox from this function.
Reimplemented from juce::Drawable.
|
overridevirtual |
Creates a path that describes the outline of this drawable.
Implements juce::Drawable.