Simp module

bitmap_load_from_memory

procedureSource

Like bitmap_load, for an image that is already in memory.

Example↗
#import "Extensions/Image";

png := encode_png(make_image(2, 2, .RGB8));
defer free(png.data);

bitmap: Bitmap;
assert(bitmap_load_from_memory(*bitmap, png));
defer deinit(*bitmap);
assert(bitmap.width == 2 && bitmap.format == .RGB8);
bitmap_load_from_memory :: (bitmap: *Bitmap, memory: [] u8) -> bool

Like bitmap_load, for an image that is already in memory.

Parameters

bitmap: *Bitmap
receives the pixels. Free them with deinit.
memory: [] u8
the bytes of an image file.

Returns

bool
Example↗
#import "Extensions/Image";

png := encode_png(make_image(2, 2, .RGB8));
defer free(png.data);

bitmap: Bitmap;
assert(bitmap_load_from_memory(*bitmap, png));
defer deinit(*bitmap);
assert(bitmap.width == 2 && bitmap.format == .RGB8);

See also