Reads an image file into bitmap. Returns false when the file is missing or is not an image.
The bitmap comes out as R8, RG8, RGB8 or RGBA8, whichever matches the channels in the file.
- bitmap: receives the pixels. Free them with
deinit. - filepath: an image file in a format
stb_imagereads, such as PNG or JPEG.
bitmap: Bitmap;
if !bitmap_load(*bitmap, "sprite.png") return;
defer deinit(*bitmap);This one is only checked to compile, not run.
bitmap_load :: (bitmap: *Bitmap, filepath: string) -> bool
Reads an image file into bitmap. Returns false when the file is missing or is not an image.
The bitmap comes out as R8, RG8, RGB8 or RGBA8, whichever matches the channels in the file.
Parameters
- bitmap: *Bitmap
- receives the pixels. Free them with
deinit. - filepath: string
- an image file in a format
stb_imagereads, such as PNG or JPEG.
Returns
- bool
bitmap: Bitmap;
if !bitmap_load(*bitmap, "sprite.png") return;
defer deinit(*bitmap);This one is only checked to compile, not run.