Esempio n. 1
0
void DoGBAExport(const std::vector<Image32Bpp>& images32, const std::vector<Image32Bpp>& tilesets32, const std::vector<Image32Bpp>& palettes32)
{
    std::vector<Image16Bpp> images;
    for (const auto& image : images32)
        images.push_back(Image16Bpp(image));

    std::vector<Image16Bpp> tilesets;
    for (const auto& image : tilesets32)
        tilesets.push_back(Image16Bpp(image));

    std::shared_ptr<Palette> palette;
    if (!palettes32.empty())
    {
        std::vector<Image16Bpp> palettes;
        for (const auto& image : palettes32)
            palettes.push_back(Image16Bpp(image));
        Image8BppScene scene(palettes, params.symbol_base_name);
        palette = scene.palette;
    }

    if (params.affine && params.bpp == 4 && (params.mode == "0" || params.mode == "MAP" || params.mode == "TILES" || params.mode == "TILEMAP"))
        FatalLog("GBA Affine Maps are 8 bpp only.");

    if (params.mode == "0" || params.mode == "TILEMAP")
        DoMode0Export(images);
    else if (params.mode == "3" || params.mode == "BITMAP")
        DoMode3Export(images);
    else if (params.mode == "4" || params.mode == "INDEXED")
        DoMode4Export(images, palette);
    else if (params.mode == "SPRITES")
        DoSpriteExport(images, palette);
    else if (params.mode == "TILES")
        DoTilesetExport(images, palette);
    else if (params.mode == "MAP")
        DoMapExport(images, tilesets);
    else if (params.mode == "PALETTE")
        DoPaletteExport(images);
}
void ConvertToMode3(std::map<std::string, ImageInfo>& images, std::vector<Image16Bpp>& images16)
{
    DefaultParams();
    for (const auto& filename_imageinfo : images)
    {
        const auto& filename = filename_imageinfo.first;
        const auto& info = filename_imageinfo.second;
        for (auto image : info.GetImages())
        {
            Magick::Geometry geom(info.GetWidth(), info.GetHeight());
            geom.aspect(true);
            image.resize(geom);
            images16.emplace_back(Image16Bpp(Image32Bpp(image, info.GetName(), filename, image.scene(), info.IsAnimated())));
        }
    }
}