本文整理汇总了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;
}
}
示例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;
}
示例3: ResizeOptions
public ResizeOptions(
int width,
int height) {
this(width, height, BitmapUtil.MAX_BITMAP_SIZE);
}
示例4: getPreferredWidth
public int getPreferredWidth() {
return (mResizeOptions != null) ? mResizeOptions.width : (int) BitmapUtil.MAX_BITMAP_SIZE;
}
示例5: getPreferredHeight
public int getPreferredHeight() {
return (mResizeOptions != null) ? mResizeOptions.height : (int) BitmapUtil.MAX_BITMAP_SIZE;
}