int Texture::read(FILE* f){ FILE *fp; if(fscanf(f," %s",filename) != 1){return 0;} fp=fopen(filename,"rb"); if(fp==NULL){return 0;} img=BMPReadImage(fp); if(fclose(fp) != 0){return 0;} return 1; }
int Image32::ReadImage(char* fileName) { char* ext=GetFileExtension(fileName); int ret=0; if(!strcasecmp(ext,"bmp")) { ret=BMPReadImage(fileName,*this); } else if(!strcasecmp(ext,"jpg") || !strcasecmp(ext,"jpeg")) { ret=JPEGReadImage(fileName,*this); } else {}; // Unknown format delete[] ext; return ret; }