JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::ScaledImage Class Reference

An image that will be resampled before it is drawn. More...

#include <juce_ScaledImage.h>

Collaboration diagram for juce::ScaledImage:

Public Member Functions

 ScaledImage ()=default
 Creates a ScaledImage with an invalid image and unity scale. More...
 
 ScaledImage (const Image &imageIn)
 Creates a ScaledImage from an Image, where the dimensions of the image in pixels are exactly equal to its dimensions in points. More...
 
 ScaledImage (const Image &imageIn, double scaleIn)
 Creates a ScaledImage from an Image, using a custom scale factor. More...
 
Image getImage () const
 Returns the image at its original dimensions. More...
 
double getScale () const
 Returns the image's scale. More...
 
Rectangle< double > getScaledBounds () const
 Returns the bounds of this image expressed in points. More...
 

Private Attributes

Image image
 
double scaleFactor = 1.0
 

Detailed Description

An image that will be resampled before it is drawn.

A plain Image only stores plain pixels, but does not store any information about how these pixels correspond to points. This means that if the image's dimensions are interpreted as points, then the image will be blurry when drawn on high resolution displays. If the image's dimensions are instead interpreted as corresponding to exact pixel positions, then the logical size of the image will change depending on the scale factor of the screen used to draw it.

The ScaledImage class is designed to store an image alongside a scale factor that informs a renderer how to convert between the image's pixels and points.

Constructor & Destructor Documentation

◆ ScaledImage() [1/3]

juce::ScaledImage::ScaledImage ( )
default

Creates a ScaledImage with an invalid image and unity scale.

◆ ScaledImage() [2/3]

juce::ScaledImage::ScaledImage ( const Image imageIn)
inlineexplicit

Creates a ScaledImage from an Image, where the dimensions of the image in pixels are exactly equal to its dimensions in points.

◆ ScaledImage() [3/3]

juce::ScaledImage::ScaledImage ( const Image imageIn,
double  scaleIn 
)
inline

Creates a ScaledImage from an Image, using a custom scale factor.

A scale of 1.0 means that the image's dimensions in pixels is equal to its dimensions in points.

A scale of 2.0 means that the image contains 2 pixels per point in each direction.

Member Function Documentation

◆ getImage()

Image juce::ScaledImage::getImage ( ) const
inline

Returns the image at its original dimensions.

◆ getScale()

double juce::ScaledImage::getScale ( ) const
inline

Returns the image's scale.

References juce::gl::scaleFactor.

◆ getScaledBounds()

Rectangle<double> juce::ScaledImage::getScaledBounds ( ) const
inline

Returns the bounds of this image expressed in points.

References juce::gl::scaleFactor.

Member Data Documentation

◆ image

Image juce::ScaledImage::image
private

◆ scaleFactor

double juce::ScaledImage::scaleFactor = 1.0
private

The documentation for this class was generated from the following file: