Class · aurore
aurore::Image
#include <aurore/views/image.hpp>
class aurore::Image : public aurore::ViewDescription
An image. The view will try to grow as much as possible to fit the image. The scaling type dictates what to do with the image if there is not enough or too much space for the view compared to the image inside. Supported formats are: JPG, PNG, TGA, BMP and GIF (not animated).
Constructors 2
An empty image (FIT, centred, linear interpolation).
image.hpp:70Functions 21
virtual void draw( NVGcontext *vg,float x,float y,float width,float height,Style style,FrameContext *ctx) overrideCalled by frame() to draw the view onscreen. Views should not draw outside of their bounds (they may be clipped if they do so).
Overrides aurore::View::draw
void setInterpolation(ImageInterpolation interpolation) Sets the interpolation method for the image. Default is LINEAR.
As the interpolation is set when the texture is created, and since we don't want to always store the image buffer in the view, this only takes effect after (re) loading the image using the setImage* methods.
If you are using the interpolation XML attribute, you have to set it before the actual image attribute.
image.hpp:86Sets the image from the given resource name.
See Image class documentation for the list of supported image formats.
image.hpp:94Sets the image from the given file path.
See Image class documentation for the list of supported image formats.
image.hpp:102Sets the image from the given file path, decoded on the decode thread (Threading::asyncDecode): the UI thread only uploads the pixels, so a grid of covers does not stall while they load. The image stays as it was until then (a cached texture is shown at once). An image set again meanwhile, or deleted, drops the result.
image.hpp:111Sets the image from memory.
See Image class documentation for the list of supported image formats.
image.hpp:119Sets the image from raw RGBA pixels (width × height × 4 bytes), for an image made by the app (a QR code, a video frame, a thumbnail it decoded). Pixels of the same size as the image shown replace its own texture's in place, without making a new one.
image.hpp:127Shows the picture of the image slot key (Theme::addImageSlot): the theme's, else the app's fallback, and follows the theme as it changes (the new picture shown once loaded; none: the image is cleared). XML: themeImage="playguard/loading/art". Another setImage* call, or "", stops following it.
The image slot followed (setThemeImage()), "" for none.
image.hpp:138Shows the nanovg image texture (what every setImage* ends with).
void setImageAsync( std::function< void(std::function< void(const std::string &, size_t length)>)> cb)cb gets a function to call, from any thread, with the encoded image's bytes: the image is set from them on the main thread (nothing if the view is gone or length is 0).
Shows nothing (the texture freed when the image owns it).
image.hpp:149void setScalingType(ImageScalingType scalingType) ImageScalingType getScalingType() void setImageAlign(ImageAlignment align) Sets the alignment of the image inside the view. Only used if scaling it set to FIT when the aspect ratio is different or CROP, to change the region of the image to draw.
Default is CENTER.
image.hpp:168Whether to destroy the current texture before updating the image texture
image.hpp:173The nanovg image shown, 0 for none.
image.hpp:177The size of the picture shown, in pixels.
image.hpp:179Also the functions of aurore::View (221).
Static functions 1
static View * create() Makes an image for XML (<aurore:Image>).
Protected functions 4
Deletes the texture if owned, or hands it back to TextureCache.
image.hpp:212Protected attributes 13
Bumped each time the image is set: an async load set before is stale.
image.hpp:209Read from Aurore's headers by Doxygen at each build · library/include