Loading...
Searching...
No Matches
juce::DrawableImage Class Reference

Detailed Description

A drawable object which is a bitmap image.

See also
Drawable

The documentation for this class was generated from the following file:
Inheritance diagram for juce::DrawableImage:

Public Member Functions

 DrawableImage ()=default
 DrawableImage (const DrawableImage &)=default
 DrawableImage (const Image &imageToUse)
 Sets the image that this drawable will render.
 DrawableImage (const Image &image, Rectangle< int > destinationBounds, Rectangle< int > sourceBounds)
 Sets the image that this drawable will render.
void setImage (const Image &imageToUse)
 Sets the image that this drawable will render.
const ImagegetImage () const noexcept
 Returns the current image.
void setOpacity (float newOpacity)
 Sets the opacity to use when drawing the image.
float getOpacity () const noexcept
 Returns the image's opacity.
void setOverlayColour (Colour newOverlayColour)
 Sets a colour to draw over the image's alpha channel.
Colour getOverlayColour () const noexcept
 Returns the overlay colour.
void setBoundingBox (Parallelogram< float > newBounds)
 Sets the bounding box within which the image should be displayed.
void setBoundingBox (Rectangle< float > newBounds)
 Sets the bounding box within which the image should be displayed.
Parallelogram< float > getBoundingBox () const noexcept
 Returns the position to which the image's top-left corner should be remapped in the target coordinate space when rendering this object.
void setImageResamplingQuality (Graphics::ResamplingQuality newQuality)
 Sets the resampling quality to use when drawing the image.
bool hitTest (Point< float >) const override
 Tests whether a given point is inside the Drawable.
std::unique_ptr< DrawablecreateCopy () 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.
Path getOutlineAsPath () const override
 Creates a path that describes the outline of this drawable.
bool isImage () const override
void paint (Graphics &g) const override
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.
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.
virtual bool replaceColour (Colour originalColour, Colour replacementColour)
 Recursively replaces a colour that might be used for filling or stroking.
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 StringgetName () 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 std::optional< StringgetContainedText () const
virtual bool requiresBlendBuffer () const

Additional Inherited Members

Static Public Member Functions inherited from juce::Drawable
static std::unique_ptr< DrawablecreateFromImageData (const void *data, size_t numBytes)
 Tries to turn some kind of image file into a drawable.
static std::unique_ptr< DrawablecreateFromImageDataStream (InputStream &dataSource)
 Tries to turn a stream containing some kind of image data into a drawable.
static std::unique_ptr< DrawablecreateFromImageFile (const File &file)
 Tries to turn a file containing some kind of image data into a drawable.
static std::unique_ptr< DrawablecreateFromSVGFile (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< DrawableCompositecreateFromSVGString (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 ()

Constructors and Destructors

◆ DrawableImage() [1/4]

juce::DrawableImage::DrawableImage ( )
default

Referenced by DrawableImage().

◆ DrawableImage() [2/4]

juce::DrawableImage::DrawableImage ( const DrawableImage & )
default

References DrawableImage().

◆ DrawableImage() [3/4]

juce::DrawableImage::DrawableImage ( const Image & imageToUse)
explicit

Sets the image that this drawable will render.

◆ DrawableImage() [4/4]

juce::DrawableImage::DrawableImage ( const Image & image,
Rectangle< int > destinationBounds,
Rectangle< int > sourceBounds )

Sets the image that this drawable will render.

Only the part specified by sourceBounds will be drawn in the area specified by destinationBounds.

Member Functions

◆ setImage()

void juce::DrawableImage::setImage ( const Image & imageToUse)

Sets the image that this drawable will render.

◆ getImage()

const Image & juce::DrawableImage::getImage ( ) const
inlinenoexcept

Returns the current image.

◆ setOpacity()

void juce::DrawableImage::setOpacity ( float newOpacity)

Sets the opacity to use when drawing the image.

◆ getOpacity()

float juce::DrawableImage::getOpacity ( ) const
inlinenoexcept

Returns the image's opacity.

◆ setOverlayColour()

void juce::DrawableImage::setOverlayColour ( Colour newOverlayColour)

Sets a colour to draw over the image's alpha channel.

By default this is transparent so isn't drawn, but if you set a non-transparent colour here, then it will be overlaid on the image, using the image's alpha channel as a mask.

This is handy for doing things like darkening or lightening an image by overlaying it with semi-transparent black or white.

◆ getOverlayColour()

Colour juce::DrawableImage::getOverlayColour ( ) const
inlinenoexcept

Returns the overlay colour.

◆ setBoundingBox() [1/2]

void juce::DrawableImage::setBoundingBox ( Parallelogram< float > newBounds)

Sets the bounding box within which the image should be displayed.

◆ setBoundingBox() [2/2]

void juce::DrawableImage::setBoundingBox ( Rectangle< float > newBounds)

Sets the bounding box within which the image should be displayed.

◆ getBoundingBox()

Parallelogram< float > juce::DrawableImage::getBoundingBox ( ) const
inlinenoexcept

Returns the position to which the image's top-left corner should be remapped in the target coordinate space when rendering this object.

See also
setTransform

◆ setImageResamplingQuality()

void juce::DrawableImage::setImageResamplingQuality ( Graphics::ResamplingQuality newQuality)

Sets the resampling quality to use when drawing the image.

This will have the most noticeable effect when the DrawableImage size does not match the image size.

Defaults to highResamplingQuality.

◆ hitTest()

bool juce::DrawableImage::hitTest ( Point< float > ) const
overridevirtual

Tests whether a given point is inside the Drawable.

Implements juce::Drawable.

◆ createCopy()

std::unique_ptr< Drawable > juce::DrawableImage::createCopy ( ) const
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.

◆ getDrawableBoundsUntransformed()

Rectangle< float > juce::DrawableImage::getDrawableBoundsUntransformed ( ) const
overridevirtual

Returns the area that this drawable covers in its original coordinate system.

These bounds are not affected by setDrawableTransform().

See also
getDrawableBounds

Implements juce::Drawable.

◆ getOutlineAsPath()

Path juce::DrawableImage::getOutlineAsPath ( ) const
overridevirtual

Creates a path that describes the outline of this drawable.

Implements juce::Drawable.

◆ isImage()

bool juce::DrawableImage::isImage ( ) const
overridevirtual

Reimplemented from juce::Drawable.

◆ paint()

void juce::DrawableImage::paint ( Graphics & g) const
overridevirtual

Implements juce::Drawable.

linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram