当前位置: 首页>>代码示例>>Java>>正文


Java BitmapPool类代码示例

本文整理汇总了Java中org.osmdroid.tileprovider.BitmapPool的典型用法代码示例。如果您正苦于以下问题:Java BitmapPool类的具体用法?Java BitmapPool怎么用?Java BitmapPool使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BitmapPool类属于org.osmdroid.tileprovider包,在下文中一共展示了BitmapPool类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDrawable

import org.osmdroid.tileprovider.BitmapPool; //导入依赖的package包/类
@Override
	public Drawable getDrawable(final InputStream aFileInputStream) {
		try {
			// default implementation will load the file as a bitmap and create
			// a BitmapDrawable from it
			BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();
			BitmapPool.getInstance().applyReusableOptions(bitmapOptions);
			final Bitmap bitmap = BitmapFactory.decodeStream(aFileInputStream, null, bitmapOptions);
			if (bitmap != null) {
				return new ReusableBitmapDrawable(bitmap);
			}
		} catch (final OutOfMemoryError e) {
//			logger.error("OutOfMemoryError loading bitmap");
			System.gc();
//			throw new LowMemoryException(e);
		}
		return null;
	}
 
开发者ID:Arman92,项目名称:Mapsforge-OsmDroid-GraphHopper,代码行数:19,代码来源:MFTileSource.java

示例2: getDrawable

import org.osmdroid.tileprovider.BitmapPool; //导入依赖的package包/类
@Override
public Drawable getDrawable(final InputStream aFileInputStream) throws LowMemoryException {
	try {
		// default implementation will load the file as a bitmap and create
		// a BitmapDrawable from it
		BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();
		BitmapPool.getInstance().applyReusableOptions(bitmapOptions);
		final Bitmap bitmap = BitmapFactory.decodeStream(aFileInputStream, null, bitmapOptions);
		if (bitmap != null) {
			return new ReusableBitmapDrawable(bitmap);
		}
	} catch (final OutOfMemoryError e) {
		Log.e(IMapView.LOGTAG,"OutOfMemoryError loading bitmap");
		System.gc();
		throw new LowMemoryException(e);
	} catch (Exception ex) {
		Log.w(IMapView.LOGTAG,"#547 Error loading bitmap" + pathBase(), ex);
	}
	return null;
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:21,代码来源:BitmapTileSourceBase.java

示例3: getTileBitmap

import org.osmdroid.tileprovider.BitmapPool; //导入依赖的package包/类
/**
 * Try to get a tile bitmap from the pool, otherwise allocate a new one
 *
 * @param pTileSizePx
 * @return
 */
public static Bitmap getTileBitmap(final int pTileSizePx) {
    final Bitmap bitmap = BitmapPool.getInstance().obtainSizedBitmapFromPool(pTileSizePx, pTileSizePx);
    if (bitmap != null) {
        return bitmap;
    }
    return Bitmap.createBitmap(pTileSizePx, pTileSizePx, Bitmap.Config.ARGB_8888);
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:14,代码来源:MapTileApproximater.java

示例4: tileLoaded

import org.osmdroid.tileprovider.BitmapPool; //导入依赖的package包/类
@Override
protected void tileLoaded(final MapTileRequestState pState, final Drawable pDrawable) {
	removeTileFromQueues(pState.getMapTile());
	// don't return the tile because we'll wait for the fs provider to ask for it
	// this prevent flickering when a load of delayed downloads complete for tiles
	// that we might not even be interested in any more
	pState.getCallback().mapTileRequestCompleted(pState, null);
	// We want to return the Bitmap to the BitmapPool if applicable
	if (pDrawable instanceof ReusableBitmapDrawable)
		BitmapPool.getInstance().returnDrawableToPool((ReusableBitmapDrawable) pDrawable);
}
 
开发者ID:osmdroid,项目名称:osmdroid,代码行数:12,代码来源:MapTileDownloader.java


注:本文中的org.osmdroid.tileprovider.BitmapPool类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。