android.graphics.Bitmap.reconfigure()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(245)

本文整理了Java中android.graphics.Bitmap.reconfigure()方法的一些代码示例,展示了Bitmap.reconfigure()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bitmap.reconfigure()方法的具体详情如下:
包路径:android.graphics.Bitmap
类名称:Bitmap
方法名:reconfigure

Bitmap.reconfigure介绍

暂无

代码示例

代码示例来源:origin: bumptech/glide

@Override
@Nullable
public Bitmap get(int width, int height, Bitmap.Config config) {
 int size = Util.getBitmapByteSize(width, height, config);
 Key bestKey = findBestKey(size, config);
 Bitmap result = groupedMap.get(bestKey);
 if (result != null) {
  // Decrement must be called before reconfigure.
  decrementBitmapOfSize(bestKey.size, result);
  result.reconfigure(width, height, config);
 }
 return result;
}

代码示例来源:origin: robolectric/robolectric

@Config(sdk = Build.VERSION_CODES.KITKAT)
@Test
public void reconfigure_withArgb8888Bitmap_validDimensionsAndConfig_doesNotThrow() {
 Bitmap original = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
 original.reconfigure(100, 100, Bitmap.Config.ARGB_8888);
}

代码示例来源:origin: bumptech/glide

@Override
@Nullable
public Bitmap get(int width, int height, Bitmap.Config config) {
 final int size = Util.getBitmapByteSize(width, height, config);
 Key key = keyPool.get(size);
 Integer possibleSize = sortedSizes.ceilingKey(size);
 if (possibleSize != null && possibleSize != size && possibleSize <= size * MAX_SIZE_MULTIPLE) {
  keyPool.offer(key);
  key = keyPool.get(possibleSize);
 }
 // Do a get even if we know we don't have a bitmap so that the key moves to the front in the
 // lru pool
 final Bitmap result = groupedMap.get(key);
 if (result != null) {
  result.reconfigure(width, height, config);
  decrementBitmapOfSize(possibleSize);
 }
 return result;
}

代码示例来源:origin: robolectric/robolectric

@Config(sdk = Build.VERSION_CODES.O)
@Test(expected = IllegalStateException.class)
public void reconfigure_withHardwareBitmap_validDimensionsAndConfig_throws() {
 Bitmap original = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
 ShadowBitmap shadowBitmap = Shadow.extract(original);
 shadowBitmap.setConfig(Bitmap.Config.HARDWARE);
 original.reconfigure(100, 100, Bitmap.Config.ARGB_8888);
}

代码示例来源:origin: guolindev/giffun

@Override
public Bitmap get(int width, int height, Bitmap.Config config) {
  int size = Util.getBitmapByteSize(width, height, config);
  Key targetKey = keyPool.get(size, config);
  Key bestKey = findBestKey(targetKey, size, config);
  Bitmap result = groupedMap.get(bestKey);
  if (result != null) {
    // Decrement must be called before reconfigure.
    decrementBitmapOfSize(Util.getBitmapByteSize(result), result.getConfig());
    result.reconfigure(width, height,
        result.getConfig() != null ? result.getConfig() : Bitmap.Config.ARGB_8888);
  }
  return result;
}

代码示例来源:origin: guolindev/giffun

@Override
public Bitmap get(int width, int height, Bitmap.Config config) {
  final int size = Util.getBitmapByteSize(width, height, config);
  Key key = keyPool.get(size);
  Integer possibleSize = sortedSizes.ceilingKey(size);
  if (possibleSize != null && possibleSize != size && possibleSize <= size * MAX_SIZE_MULTIPLE) {
    keyPool.offer(key);
    key = keyPool.get(possibleSize);
  }
  // Do a get even if we know we don't have a bitmap so that the key moves to the front in the lru pool
  final Bitmap result = groupedMap.get(key);
  if (result != null) {
    result.reconfigure(width, height, config);
    decrementBitmapOfSize(possibleSize);
  }
  return result;
}

代码示例来源:origin: mozilla-tw/Rocket

@Override
@Nullable
public Bitmap get(int width, int height, Bitmap.Config config) {
 int size = Util.getBitmapByteSize(width, height, config);
 Key bestKey = findBestKey(size, config);
 Bitmap result = groupedMap.get(bestKey);
 if (result != null) {
  // Decrement must be called before reconfigure.
  decrementBitmapOfSize(bestKey.size, result);
  result.reconfigure(width, height,
    result.getConfig() != null ? result.getConfig() : Bitmap.Config.ARGB_8888);
 }
 return result;
}

代码示例来源:origin: com.facebook.testing.screenshot/core

@TargetApi(Build.VERSION_CODES.KITKAT)
private void drawTile(View measuredView, int i, int j, RecordBuilderImpl recordBuilder)
  throws IOException {
 int width = measuredView.getWidth();
 int height = measuredView.getHeight();
 int left = i * mTileSize;
 int top = j * mTileSize;
 int right = Math.min(left + mTileSize, width);
 int bottom = Math.min(top + mTileSize, height);
 lazyInitBitmap();
 if (mEnableBitmapReconfigure) {
  mBitmap.reconfigure(right - left, bottom - top, Bitmap.Config.ARGB_8888);
  mCanvas = new Canvas(mBitmap);
 }
 clearCanvas(mCanvas);
 drawClippedView(measuredView, left, top, mCanvas);
 String tempName = mAlbum.writeBitmap(recordBuilder.getName(), i, j, mBitmap);
 if (tempName == null) {
  throw new NullPointerException();
 }
 recordBuilder.getTiling().setAt(left / mTileSize, top / mTileSize, tempName);
}

代码示例来源:origin: enricocid/LaunchEnr

} else {
  if (preview.getWidth() > size || preview.getHeight() > size) {
    preview.reconfigure(size, size, preview.getConfig());

代码示例来源:origin: enricocid/LaunchEnr

preview.reconfigure(preview.getWidth(), previewHeight, preview.getConfig());

代码示例来源:origin: mozilla-tw/Rocket

@Override
@Nullable
public Bitmap get(int width, int height, Bitmap.Config config) {
 final int size = Util.getBitmapByteSize(width, height, config);
 Key key = keyPool.get(size);
 Integer possibleSize = sortedSizes.ceilingKey(size);
 if (possibleSize != null && possibleSize != size && possibleSize <= size * MAX_SIZE_MULTIPLE) {
  keyPool.offer(key);
  key = keyPool.get(possibleSize);
 }
 // Do a get even if we know we don't have a bitmap so that the key moves to the front in the
 // lru pool
 final Bitmap result = groupedMap.get(key);
 if (result != null) {
  result.reconfigure(width, height, config);
  decrementBitmapOfSize(possibleSize);
 }
 return result;
}

相关文章