An image with its halved levels down to 16 px, each halving a rounded 2x2 box average, so drawing it smaller picks the nearest larger level and stays sharp without aliasing.
More...
|
| | MipMap ()=default |
| | MipMap (const juce::Image &src, const Enhance &enhance={}) |
| void | setImage (const juce::Image &src, const Enhance &enhance={}) |
| | Builds the levels from an image; a null image leaves the MipMap empty.
|
| void | setImage (const juce::File &f, const Enhance &enhance={}) |
| void | setImage (const void *rawData, size_t numBytesOfData, const Enhance &enhance={}) |
| void | draw (juce::Graphics &g, juce::Rectangle< float > rc, juce::RectanglePlacement placement=0) const |
| | Draws the level that fits rc at the context's physical pixel scale.
|
| juce::Image | getImageFor (const int width, const int height) const |
| | The level for a size in pixels: the smallest one at least that big, the largest for an empty size.
|
| juce::Image | getImage () const |
| | The full size source level.
|
| juce::Rectangle< int > | getBounds () const |
| int | numMipMaps () const |
| bool | isValid () const |
| bool | isNull () const |
| int | getWidth () const |
| int | getHeight () const |
| int | getNumBytesOfData () const |
| | The pixel memory of all levels.
|
| const Enhance & | getEnhance () const |
| bool | operator== (const MipMap &other) const |
| | The same levels: equal when built from the same setImage() call or a copy of it.
|
An image with its halved levels down to 16 px, each halving a rounded 2x2 box average, so drawing it smaller picks the nearest larger level and stays sharp without aliasing.
draw() picks the level for the physical pixel size (HiDPI included) and draws it with low resampling quality when the level matches the size exactly, high otherwise.
Copies are cheap: the levels are juce::Image objects, which share their pixels.
gin::MipMap cover { juce::ImageFileFormat::loadFrom (file) };
void paint (juce::Graphics& g) override
{
cover.draw (g, getLocalBounds().toFloat(), juce::RectanglePlacement::centred);
}
- See also
- drawBlend, MipMapEnhance