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


Java BitmapUtil.MAX_BITMAP_SIZE属性代码示例

本文整理汇总了Java中com.facebook.imageutils.BitmapUtil.MAX_BITMAP_SIZE属性的典型用法代码示例。如果您正苦于以下问题:Java BitmapUtil.MAX_BITMAP_SIZE属性的具体用法?Java BitmapUtil.MAX_BITMAP_SIZE怎么用?Java BitmapUtil.MAX_BITMAP_SIZE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.facebook.imageutils.BitmapUtil的用法示例。


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

示例1: isImageBigEnough

/**
 * Checks whether the producer may be able to produce images of the specified size. This makes no
 * promise about being able to produce images for a particular source, only generally being able
 * to produce output of the desired resolution.
 *
 * @param width the desired width
 * @param height the desired height
 * @return true if the producer can meet these needs
 */
public static boolean isImageBigEnough(int width, int height, ResizeOptions resizeOptions) {
  if (resizeOptions == null) {
    return getAcceptableSize(width) >= BitmapUtil.MAX_BITMAP_SIZE
        && getAcceptableSize(height) >= (int) BitmapUtil.MAX_BITMAP_SIZE;
  } else {
    return getAcceptableSize(width) >= resizeOptions.width
        && getAcceptableSize(height) >= resizeOptions.height;
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:ThumbnailSizeChecker.java

示例2: determineSampleSize

/**
 * Get the factor between the dimensions of the encodedImage (actual image) and the ones of the
 * imageRequest (requested size).
 *
 * @param imageRequest the request containing the requested dimensions
 * @param encodedImage the encoded image with the actual dimensions
 * @return
 */
public static int determineSampleSize(ImageRequest imageRequest, EncodedImage encodedImage) {
  if (!EncodedImage.isMetaDataAvailable(encodedImage)) {
    return DEFAULT_SAMPLE_SIZE;
  }
  float ratio = determineDownsampleRatio(imageRequest, encodedImage);
  int sampleSize;
  if (encodedImage.getImageFormat() == DefaultImageFormats.JPEG) {
    sampleSize = ratioToSampleSizeJPEG(ratio);
  } else {
    sampleSize = ratioToSampleSize(ratio);
  }

  // Check the case when the dimension of the downsampled image is still larger than the max
  // possible dimension for an image.
  int maxDimension = Math.max(encodedImage.getHeight(), encodedImage.getWidth());
  final ResizeOptions resizeOptions = imageRequest.getResizeOptions();
  final float maxBitmapSize = resizeOptions != null
      ? resizeOptions.maxBitmapSize
      : BitmapUtil.MAX_BITMAP_SIZE;
  while (maxDimension / sampleSize > maxBitmapSize) {
    if (encodedImage.getImageFormat() == DefaultImageFormats.JPEG) {
      sampleSize *= 2;
    } else {
      sampleSize++;
    }
  }
  return sampleSize;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:36,代码来源:DownsampleUtil.java

示例3: ResizeOptions

public ResizeOptions(
    int width,
    int height) {
  this(width, height, BitmapUtil.MAX_BITMAP_SIZE);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:ResizeOptions.java

示例4: getPreferredWidth

public int getPreferredWidth() {
  return (mResizeOptions != null) ? mResizeOptions.width : (int) BitmapUtil.MAX_BITMAP_SIZE;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:3,代码来源:ImageRequest.java

示例5: getPreferredHeight

public int getPreferredHeight() {
  return (mResizeOptions != null) ? mResizeOptions.height : (int) BitmapUtil.MAX_BITMAP_SIZE;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:3,代码来源:ImageRequest.java


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