org.oscim.utils.TextureAtlasUtils Maven / Gradle / Ivy
/*
* Copyright 2017 Longri
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see .
*/
package org.oscim.utils;
import org.oscim.backend.canvas.Bitmap;
import org.oscim.renderer.atlas.TextureAtlas;
import org.oscim.renderer.atlas.TextureRegion;
import org.oscim.utils.math.MathUtils;
import java.util.List;
import java.util.Map;
public class TextureAtlasUtils {
private static final int MAX_ATLAS_SIZE = 2048;
private static final int PAD = 2;
/**
* Create atlas texture regions from bitmaps.
*
* @param inputMap input bitmaps
* @param outputMap generated texture regions
* @param atlasList created texture atlases
* @param disposeBitmaps recycle input bitmaps
* @param flipY texture items flip over y (needed on iOS)
*/
public static void createTextureRegions(final Map