本文整理匯總了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);
}
示例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);
}
示例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;
}
示例4: Sprite
import org.oscim.renderer.atlas.TextureAtlas; //導入依賴的package包/類
public Sprite(T i, TextureAtlas a, Rect r) {
atlas = a;
rect = r;
item = i;
}