MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / LoadImage

Function LoadImage

LibLemon/src/gfx/image.cpp:15–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13 }
14
15 int LoadImage(FILE* f, surface_t* surface){
16 char sig[8];
17 fseek(f, 0, SEEK_SET);
18
19 if(fread(sig, 8, 1, f) <= 0) {
20 return -2; // Could not read first 8 bytes of image
21 }
22
23 int type = IdentifyImage(sig);
24
25 if(type == Image_BMP){
26 return LoadBitmapImage(f, surface);
27 } else if(type == Image_PNG){
28 return LoadPNGImage(f, surface);
29 } else return -1;
30 }
31
32 int LoadImage(const char* path, surface_t* surface){
33 FILE* imageFile = fopen(path, "rb");

Callers 3

LoadBackgroundFunction · 0.50
mainFunction · 0.50
InitializeFVIconsFunction · 0.50

Calls 5

IdentifyImageFunction · 0.85
LoadBitmapImageFunction · 0.85
LoadPNGImageFunction · 0.85
InterpolateFunction · 0.85
floorFunction · 0.85

Tested by

no test coverage detected