![]() |
CRM64Pro GDK v0.15.0
A free cross-platform game development kit built on top of SDL 3.0
|
Image Manager and Image objects for handling surfaces and textures [v26.02.0].
The Image module provides unified management for images and textures used by all graphic modules in the GDK. It supports BMP and PNG external files as well as SDL_Surface sources. Images can be saved to and loaded from CDC archives (using CDC v1.x specification).
| Source surface | Standard SDL_Surface where the imported BMP, PNG or SDL_Surface is stored |
|---|---|
| Textures | One texture per screen. Created "offline" via optimize() or "online" automatically on first render. Always created with SDL_TEXTUREACCESS_TARGET flag |
| Attributes | Color key (transparency), alpha value (surface transparency), color modulation and blending mode (SDL_BlendMode) |
The following filters can be applied to images (affects source surface and all textures):
| Noise | Adds random noise effect |
|---|---|
| Blur | Applies blur/smoothing effect |
| Negative | Inverts color values |
| Grey | Converts to greyscale |
| Black/White | Converts to two-tone black and white |
| Wiggle | Applies wave distortion effect |
| Pixelate | Reduces resolution for pixelated effect |
| Uninitialized | Created with ImageMgr::create() but lacks source surface (set via Image::assignSurface()). Not usable |
|---|---|
| Stand-alone | Fully usable image with no children. No restrictions |
| Parent | Stand-alone image with one or more children. Restrictions: ColorKey cannot be modified, cannot be closed while children are live, name cannot be changed |
| Child | Uses parent's source surface, textures and name. Restrictions: ColorKey cannot be modified, save() calls parent's method, name cannot be changed |
Images can be rendered to any valid screen or another image:
| Image::render() | Plain rendering with optional stretch or shrink |
|---|---|
| Image::renderEx() | Extended rendering with rotation around a given point and vertical/horizontal flip effects |
This is an advanced "cloning" manager: when loading an image from a CDC file that is already loaded or created (using the name as the key), it will create a new "clone" (child) for the image. Child images share the source surface and textures with their parent for memory efficiency.
Resource names are restricted to prevent collisions with system assets. The characters '#' and '@' are reserved for internal engine use. Any attempt to create or rename a resource starting with these characters will be rejected (returning a negative error code).
Classes | |
| class | CRM64Pro::Image |
| Image Object class. More... | |
| class | CRM64Pro::ImageMgr |
| Image Manager class. More... | |
Enumerations | |
| enum | CRM64Pro::eImageFilter { CRM64Pro::IF_NOISE = 1 , CRM64Pro::IF_BLUR = 2 , CRM64Pro::IF_NEGATIVE = 3 , CRM64Pro::IF_GREY = 4 , CRM64Pro::IF_BW = 5 , CRM64Pro::IF_WIGGLE = 6 , CRM64Pro::IF_PIXELATE = 7 } |
| Image filters. More... | |
Image filters.
| Enumerator | |
|---|---|
| IF_NOISE | 'eFilter' parameter in Image::applyFilter. Apply a noise effect with a specific iValue (from 0 to 100). |
| IF_BLUR | 'eFilter' parameter in Image::applyFilter. Apply a blur effect with a specific iValue (from 0 to 100). |
| IF_NEGATIVE | 'eFilter' parameter in Image::applyFilter. Apply a negative effect. |
| IF_GREY | 'eFilter' parameter in Image::applyFilter. Apply a grey effect. |
| IF_BW | 'eFilter' parameter in Image::applyFilter. Apply a black/white effect. |
| IF_WIGGLE | 'eFilter' parameter in Image::applyFilter. Apply a wiggle effect that can be animated using variable iValue. |
| IF_PIXELATE | 'eFilter' parameter in Image::applyFilter. Apply a pixelate effect that can be animated using variable iValue. |