}
- bool init(const std::string& name, bool flipped = false)
+ void init(const std::string& name, bool flipped = false)
{
- std::string path = Image::getPath(name);
+ std::string path(name);
logInfo << "opening image file " << path << std::endl;
- FILE* fp = fopen(path.c_str(), "rb");
- if (!fp) return false;
+ FILE* fp = Image::openFile(path);
+ if (!fp) return;
png_byte signature[8];
size_t bytesRead;
pngInfo ? &pngInfo : 0,
pngInfoEnd ? &pngInfoEnd : 0);
fclose(fp);
-
- return mContext;
}
}
-std::string Image::getPath(const std::string& name)
+bool Image::getPath(std::string& name)
{
- if (boost::find_last(name, ".png"))
- {
- return Resource::getPath(name);
- }
- else
- {
- std::string path("images/");
- path += name;
- path += ".png";
- return Resource::getPath(path);
- }
+ return Resource::getPath(name, "images/", "png");
+}
+
+FILE* Image::openFile(std::string& name)
+{
+ return Resource::openFile(name, "images/", "png");
}