AImage#
Owning image representation.
| Header: | #include <AUI/Image/AImage.h> |
| CMake: | aui_link(my_target PUBLIC aui::image) |
Detailed Description#
AImage owns a pixel buffer together with its size and APixelFormat. Everything that only reads pixels (size,
get, cropped, convert, ...) is inherited from AImageView; AImage adds the mutating operations set, fill,
insert, mirrorVertically and visit.
Images are usually created by decoding a file with fromUrl, fromFile or fromBuffer; these return nullptr if
the data can't be decoded. See Loading images.
An empty image of a given size and format can be created directly:
AImage image({64, 64}, APixelFormat::RGBA_BYTE);
image.fill(0xff0000_rgb);
image.set({10, 10}, 0x00ff00_rgb);
For pixel-level work see Processing images.
Examples#
examples/ui/embedded_sdl/src/main.cpp
SDL3 — This code demonstrates how to integrate the AUI Framework with SDL3 to create a window with OpenGL rendering.
examples/app/fractal/src/FractalView.cpp
Fractal Example — Fractal viewer application demonstrating usage of custom shaders.
mShader.set(UNIFORM_TR, mTransform);
mShader.set(UNIFORM_SQ, 1.f);
mTexture = _new<gl::Texture2D>();
mTexture->tex2D(*AImage::fromUrl(":img/color_scheme_wikipedia.png"));
}
void FractalView::render(ARenderContext context) {
AView::render(context);