Functions | |
UL_IMAGE * | ulLoadImagePNG (VIRTUAL_FILE *f, int location, int pixelFormat) |
UL_IMAGE * | ulLoadImageJPG (VIRTUAL_FILE *f, int location, int pixelFormat) |
UL_IMAGE * | ulLoadImageGIF (VIRTUAL_FILE *f, int location, int pixelFormat) |
UL_IMAGE * | ulLoadImageFilePNG (const char *fileName, int fileSize, int flags, int pixelFormat) |
UL_IMAGE * | ulLoadImageFileJPG (const char *fileName, int fileSize, int flags, int pixelFormat) |
UL_IMAGE * | ulLoadImageFileGIF (const char *fileName, int fileSize, int flags, int pixelFormat) |
Here are the approximative code sizes for currently supported formats:
You can choose between 2 alternatives:
UL_IMAGE* ulLoadImagePNG | ( | VIRTUAL_FILE * | f, | |
int | location, | |||
int | pixelFormat | |||
) |
Loads a PNG file. You can pass an open virtual file, which can be open from everything (RAM, libFat, gbfs, ...).
If your PNG contains a palette and the wanted pixelFormat is paletted, then it will use that palette, in the same order. The first color will be transparent.
If your PNG doesn't contain a palette and the wanted pixelFormat is paletted, then a palette will be created from the source image, but it must not contain more than the total number of colors! The color key (ulSetTransparentColor) will be used as a transparent color.
If the wanted pixelFormat is not paletted, then the image will be loaded directly, wether it contains a palette or not. The color key will be used for transparency if your pixel format is 5551, as well as the alpha channel defined in your PNG (0 - 127 = transparent, 128 - 255 = opaque).
UL_IMAGE* ulLoadImageJPG | ( | VIRTUAL_FILE * | f, | |
int | location, | |||
int | pixelFormat | |||
) |
Loads a JPG file. Same remark as for loading PNG. The format must be 16 bits (5550 or 5551) and there is no transparency support.
UL_IMAGE* ulLoadImageGIF | ( | VIRTUAL_FILE * | f, | |
int | location, | |||
int | pixelFormat | |||
) |
Loads a GIF file. Same remarks as for loading PNG. Your GIF file can have a transparent color set, which is not the first one. The palette colors will then be swapped so that this color becomes transparent. If your GIF has no transparent color, it searches for the color key and uses this one as transparent. If it's not found or you have not defined a color key, then it uses the first palette color as transparent.
UL_IMAGE* ulLoadImageFilePNG | ( | const char * | fileName, | |
int | fileSize, | |||
int | flags, | |||
int | pixelFormat | |||
) |
Load directly from a file. If the file is a filename for FAT or GBFS, the size should be 0. If you're loading from memory, then fileName is a pointer to the memory address and fileSize its size.
See the Loading utility section for more informations.
UL_IMAGE* ulLoadImageFileJPG | ( | const char * | fileName, | |
int | fileSize, | |||
int | flags, | |||
int | pixelFormat | |||
) |
Same but for JPG.
UL_IMAGE* ulLoadImageFileGIF | ( | const char * | fileName, | |
int | fileSize, | |||
int | flags, | |||
int | pixelFormat | |||
) |
Same but for GIF.