コード例 #1
0
void ProgressivePNGImageFileReader::open(const char* filename)
{
    assert(filename);
    assert(!is_open());

    PNGImageFileReader reader;
    auto_ptr<Image> image(reader.read(filename, &impl->m_attributes));

    impl->m_image.reset(
        new Image(
            *image.get(),
            impl->m_tile_width,
            impl->m_tile_height,
            image->properties().m_pixel_format));
}
コード例 #2
0
Image* GenericImageFileReader::read(
    const char*         filename,
    ImageAttributes*    image_attributes)
{
    const filesystem::path filepath(filename);
    const string extension = lower_case(filepath.extension().string());

    if (extension == ".exr")
    {
        EXRImageFileReader reader;
        return reader.read(filename, image_attributes);
    }
    else if (extension == ".png")
    {
        PNGImageFileReader reader;
        return reader.read(filename, image_attributes);
    }
    else
    {
        throw ExceptionUnsupportedFileFormat(filename);
        return 0;
    }
}