Add PfmImage and PnmImage classes
This commit is contained in:
@@ -103,19 +103,25 @@ namespace openVulkanoCpp
|
||||
}
|
||||
return size;
|
||||
}
|
||||
};
|
||||
|
||||
static std::pair<PnmHeader, std::unique_ptr<char[]>> ReadImage(std::istream& inStream)
|
||||
struct PnmImage
|
||||
{
|
||||
PnmHeader header;
|
||||
std::unique_ptr<char[]> image;
|
||||
|
||||
static PnmImage ReadImage(std::istream& inStream)
|
||||
{
|
||||
std::pair<PnmHeader, std::unique_ptr<char[]>> image;
|
||||
inStream >> image.first;
|
||||
PnmImage image;
|
||||
inStream >> image.header;
|
||||
|
||||
// TODO handle ascii mode
|
||||
if (image.first.ascii) throw std::runtime_error("ascii mode not supported!");
|
||||
if (image.header.ascii) throw std::runtime_error("ascii mode not supported!");
|
||||
|
||||
size_t size = image.first.GetImageSize();
|
||||
image.second = std::make_unique<char[]>(size);
|
||||
inStream.read(image.second.get(), size);
|
||||
size_t size = image.header.GetImageSize();
|
||||
image.image = std::make_unique<char[]>(size);
|
||||
inStream.read(image.image.get(), size);
|
||||
return image;
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user