當前位置: 首頁>>代碼示例>>Java>>正文


Java TextureAtlas類代碼示例

本文整理匯總了Java中org.oscim.renderer.atlas.TextureAtlas的典型用法代碼示例。如果您正苦於以下問題:Java TextureAtlas類的具體用法?Java TextureAtlas怎麽用?Java TextureAtlas使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TextureAtlas類屬於org.oscim.renderer.atlas包,在下文中一共展示了TextureAtlas類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createAtlas

import org.oscim.renderer.atlas.TextureAtlas; //導入依賴的package包/類
private void createAtlas(String elementName, Attributes attributes) throws IOException {
	String img = null;

	for (int i = 0; i < attributes.getLength(); i++) {
		String name = attributes.getLocalName(i);
		String value = attributes.getValue(i);

		if ("img".equals(name)) {
			img = value;
		} else {
			XmlThemeBuilder.logUnknownAttribute(elementName, name, value, i);
		}
	}
	validateExists("img", img, elementName);

	Bitmap bitmap = CanvasAdapter.getBitmapAsset(IMG_PATH + img);
	mTextureAtlas = new TextureAtlas(bitmap);
}
 
開發者ID:opensciencemap,項目名稱:vtm,代碼行數:19,代碼來源:XmlThemeBuilder.java

示例2: createAtlas

import org.oscim.renderer.atlas.TextureAtlas; //導入依賴的package包/類
private void createAtlas(String elementName, Attributes attributes) throws IOException {
	String img = null;

	for (int i = 0; i < attributes.getLength(); i++) {
		String name = attributes.getLocalName(i);
		String value = attributes.getValue(i);

		if ("img".equals(name)) {
			img = value;
		} else if ("name".equals(name)) {
			//img = value;
		} else {
			RenderThemeHandler.logUnknownAttribute(elementName, name, value, i);
		}
	}
	if (img == null)
		throw new IllegalArgumentException(
				"missing attribute 'img' for element: "
						+ elementName);

	Bitmap bitmap = BitmapUtils.createBitmap("jar:" + img);
	mTextureAtlas = new TextureAtlas(bitmap);
}
 
開發者ID:opensciencemap,項目名稱:vtm-android,代碼行數:24,代碼來源:RenderThemeHandler.java

示例3: createTextureAtlasRegions

import org.oscim.renderer.atlas.TextureAtlas; //導入依賴的package包/類
public static LinkedHashMap<Object, TextureRegion> createTextureAtlasRegions() {
        // create TextureRegions from all Bitmap symbols
        LinkedHashMap<Object, TextureRegion> textureRegionMap = new LinkedHashMap<>();
        ObjectMap<String, MapWayPointItemStyle> list = VisUI.getSkin().getAll(MapWayPointItemStyle.class);
        Array<Bitmap> bitmapList = new Array<>();
        for (MapWayPointItemStyle style : list.values()) {
            if (style.small != null) if (!bitmapList.contains(style.small, true)) bitmapList.add(style.small);
            if (style.middle != null) if (!bitmapList.contains(style.middle, true)) bitmapList.add(style.middle);
            if (style.large != null) if (!bitmapList.contains(style.large, true)) bitmapList.add(style.large);
        }

        //add Bitmaps from MapArrowStyle
        MapArrowStyle mapArrowStyle = null;
        try {
            mapArrowStyle = VisUI.getSkin().get("myLocation", MapArrowStyle.class);
        } catch (Exception e) {
            log.error("get MapArrowStyle 'myLocation'", e);
        }

        if (mapArrowStyle != null) {
            if (mapArrowStyle.myLocation != null) bitmapList.add(mapArrowStyle.myLocation);
            if (mapArrowStyle.myLocationTransparent != null) bitmapList.add(mapArrowStyle.myLocationTransparent);
            if (mapArrowStyle.myLocationCar != null) bitmapList.add(mapArrowStyle.myLocationCar);
        }


        LinkedHashMap<Object, Bitmap> input = new LinkedHashMap<>();
        for (Bitmap bmp : bitmapList) {
            input.put(((GetName) bmp).getName(), bmp);
        }
        ArrayList<TextureAtlas> atlasList = new ArrayList<>();
        boolean flipped = CanvasAdapter.platform == Platform.IOS;
        System.out.print("create MapTextureAtlas with flipped Y? " + flipped);
        TextureAtlasUtils.createTextureRegions(input, textureRegionMap, atlasList, false,
                flipped);


//        if (false) {//Debug write atlas Bitmap to tmp folder
//            int count = 0;
//            for (TextureAtlas atlas : atlasList) {
//                byte[] data = atlas.texture.bitmap.getPngEncodedData();
//                Pixmap pixmap = new Pixmap(data, 0, data.length);
//                FileHandle file = Gdx.files.absolute(CB.WorkPath + "/user/temp/testAtlas" + count++ + ".png");
//                PixmapIO.writePNG(file, pixmap);
//                pixmap.dispose();
//            }
//        }
        return textureRegionMap;
    }
 
開發者ID:Longri,項目名稱:cachebox3.0,代碼行數:50,代碼來源:MapView.java

示例4: Sprite

import org.oscim.renderer.atlas.TextureAtlas; //導入依賴的package包/類
public Sprite(T i, TextureAtlas a, Rect r) {
	atlas = a;
	rect = r;
	item = i;
}
 
開發者ID:opensciencemap,項目名稱:vtm,代碼行數:6,代碼來源:SpriteManager.java


注:本文中的org.oscim.renderer.atlas.TextureAtlas類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。