本文整理汇总了Java中com.threed.jpct.util.BitmapHelper类的典型用法代码示例。如果您正苦于以下问题:Java BitmapHelper类的具体用法?Java BitmapHelper怎么用?Java BitmapHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BitmapHelper类属于com.threed.jpct.util包,在下文中一共展示了BitmapHelper类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadTexture
import com.threed.jpct.util.BitmapHelper; //导入依赖的package包/类
private static void loadTexture(String textureName, int id){
int count = 0;
OutOfMemoryError exc = null;
do{
try{
Bitmap texture = BitmapHelper.convert(FlagWallpaperService.context.getResources().getDrawable(id));
// if(textureName.startsWith(SKY)){
// WallpaperManager wallpaperManager = WallpaperManager.getInstance(FlagWallpaperService.context);
// int target = BitmapUtils.getBestFittingScreenPow(wallpaperManager.getDesiredMinimumWidth(), wallpaperManager.getDesiredMinimumHeight());
// texture = BitmapUtils.transform(new Matrix(), texture, target, target, true);
//// texture = getBitmap(id, target);
// Log.i("CROP", "Cropped: "+textureName +" "+texture.getWidth()+"x"+texture.getHeight() +", " +texture.getRowBytes() * texture.getHeight()+"bytes");
// }else;
// texture = BitmapHelper.convert(FlagWallpaperService.context.getResources().getDrawable(id));
loadTexture(textureName, texture);
}catch (OutOfMemoryError e) {
Log.e("FlagManger", "OutOfMemoryError while loadind "+textureName);
exc = e;
System.gc();
}
}while(exc!=null && ++count<5);
}
示例2: onSurfaceChanged
import com.threed.jpct.util.BitmapHelper; //导入依赖的package包/类
public void onSurfaceChanged(GL10 gl, int w, int h) {
if (fb != null) {
fb.dispose();
}
fb = new FrameBuffer(gl, w, h);
if (master == null) {
world = new World();
world.setAmbientLight(20, 20, 20);
sun = new Light(world);
sun.setIntensity(250, 250, 250);
// Create a texture out of the icon...:-)
Texture texture = new Texture(BitmapHelper.rescale(BitmapHelper.convert(getResources().getDrawable(R.drawable.icon)), 64, 64));
Texture sky_tex = new Texture(BitmapHelper.rescale(BitmapHelper.convert(getResources().getDrawable(R.raw.sky)), 64, 64));
TextureManager.getInstance().addTexture("texture", texture);
TextureManager.getInstance().addTexture("sky", sky_tex);
/*cube = Primitives.getCube(10);
cube.calcTextureWrapSpherical();
cube.setTexture("texture");
cube.strip();
cube.build();
*/
//world.addObject(cube);
//sky = new SkyBox("sky", "sky", "sky", "sky", "sky", "sky", 90.0f);
objects = Scene.loadLevelAE("test.txt", objects, world, assetManager);
cube = Scene.findObject("barrel", objects);
cube.scale(10.0f);
world.addObject(cube);
Camera cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEOUT, 50);
cam.lookAt(cube.getTransformedCenter());
SimpleVector sv = new SimpleVector();
sv.set(cube.getTransformedCenter());
sv.y -= 100;
sv.z -= 100;
sun.setPosition(sv);
MemoryHelper.compact();
if (master == null) {
Logger.log("Saving master Activity!");
master = MyWallpaperService.this;
}
}
}