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


Java ImageSizeUtils.computeImageScale方法代码示例

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


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

示例1: considerExactScaleAndOrientatiton

import com.nostra13.universalimageloader.utils.ImageSizeUtils; //导入方法依赖的package包/类
protected Bitmap considerExactScaleAndOrientatiton(Bitmap subsampledBitmap, ImageDecodingInfo decodingInfo,
		int rotation, boolean flipHorizontal) {
	Matrix m = new Matrix();
	// Scale to exact size if need
	ImageScaleType scaleType = decodingInfo.getImageScaleType();
	if (scaleType == ImageScaleType.EXACTLY || scaleType == ImageScaleType.EXACTLY_STRETCHED) {
		ImageSize srcSize = new ImageSize(subsampledBitmap.getWidth(), subsampledBitmap.getHeight(), rotation);
		float scale = ImageSizeUtils.computeImageScale(srcSize, decodingInfo.getTargetSize(), decodingInfo
				.getViewScaleType(), scaleType == ImageScaleType.EXACTLY_STRETCHED);
		if (Float.compare(scale, 1f) != 0) {
			m.setScale(scale, scale);

			if (loggingEnabled) {
				L.d(LOG_SCALE_IMAGE, srcSize, srcSize.scale(scale), scale, decodingInfo.getImageKey());
			}
		}
	}
	// Flip bitmap if need
	if (flipHorizontal) {
		m.postScale(-1, 1);

		if (loggingEnabled) L.d(LOG_FLIP_IMAGE, decodingInfo.getImageKey());
	}
	// Rotate bitmap if need
	if (rotation != 0) {
		m.postRotate(rotation);

		if (loggingEnabled) L.d(LOG_ROTATE_IMAGE, rotation, decodingInfo.getImageKey());
	}

	Bitmap finalBitmap = Bitmap.createBitmap(subsampledBitmap, 0, 0, subsampledBitmap.getWidth(), subsampledBitmap
			.getHeight(), m, true);
	if (finalBitmap != subsampledBitmap) {
		subsampledBitmap.recycle();
	}
	return finalBitmap;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:38,代码来源:BaseImageDecoder.java

示例2: considerExactScaleAndOrientatiton

import com.nostra13.universalimageloader.utils.ImageSizeUtils; //导入方法依赖的package包/类
protected Bitmap considerExactScaleAndOrientatiton(Bitmap subsampledBitmap, ImageDecodingInfo decodingInfo, int rotation, boolean flipHorizontal) {
    Matrix m = new Matrix();
    ImageScaleType scaleType = decodingInfo.getImageScaleType();
    if (scaleType == ImageScaleType.EXACTLY || scaleType == ImageScaleType.EXACTLY_STRETCHED) {
        float scale = ImageSizeUtils.computeImageScale(new ImageSize(subsampledBitmap.getWidth(), subsampledBitmap.getHeight(), rotation), decodingInfo.getTargetSize(), decodingInfo.getViewScaleType(), scaleType == ImageScaleType.EXACTLY_STRETCHED);
        if (Float.compare(scale, 1.0f) != 0) {
            m.setScale(scale, scale);
            if (this.loggingEnabled) {
                L.d(LOG_SCALE_IMAGE, srcSize, srcSize.scale(scale), Float.valueOf(scale), decodingInfo.getImageKey());
            }
        }
    }
    if (flipHorizontal) {
        m.postScale(-1.0f, 1.0f);
        if (this.loggingEnabled) {
            L.d(LOG_FLIP_IMAGE, decodingInfo.getImageKey());
        }
    }
    if (rotation != 0) {
        m.postRotate((float) rotation);
        if (this.loggingEnabled) {
            L.d(LOG_ROTATE_IMAGE, Integer.valueOf(rotation), decodingInfo.getImageKey());
        }
    }
    Bitmap finalBitmap = Bitmap.createBitmap(subsampledBitmap, 0, 0, subsampledBitmap.getWidth(), subsampledBitmap.getHeight(), m, true);
    if (finalBitmap != subsampledBitmap) {
        subsampledBitmap.recycle();
    }
    return finalBitmap;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:31,代码来源:BaseImageDecoder.java

示例3: considerExactScaleAndOrientatiton

import com.nostra13.universalimageloader.utils.ImageSizeUtils; //导入方法依赖的package包/类
protected Bitmap considerExactScaleAndOrientatiton(Bitmap subsampledBitmap, ImageDecodingInfo
        decodingInfo, int rotation, boolean flipHorizontal) {
    Matrix m = new Matrix();
    ImageScaleType scaleType = decodingInfo.getImageScaleType();
    if (scaleType == ImageScaleType.EXACTLY || scaleType == ImageScaleType.EXACTLY_STRETCHED) {
        float scale = ImageSizeUtils.computeImageScale(new ImageSize(subsampledBitmap
                .getWidth(), subsampledBitmap.getHeight(), rotation), decodingInfo
                .getTargetSize(), decodingInfo.getViewScaleType(), scaleType ==
                ImageScaleType.EXACTLY_STRETCHED);
        if (Float.compare(scale, 1.0f) != 0) {
            m.setScale(scale, scale);
            if (this.loggingEnabled) {
                L.d(LOG_SCALE_IMAGE, srcSize, srcSize.scale(scale), Float.valueOf(scale),
                        decodingInfo.getImageKey());
            }
        }
    }
    if (flipHorizontal) {
        m.postScale(-1.0f, 1.0f);
        if (this.loggingEnabled) {
            L.d(LOG_FLIP_IMAGE, decodingInfo.getImageKey());
        }
    }
    if (rotation != 0) {
        m.postRotate((float) rotation);
        if (this.loggingEnabled) {
            L.d(LOG_ROTATE_IMAGE, Integer.valueOf(rotation), decodingInfo.getImageKey());
        }
    }
    Bitmap finalBitmap = Bitmap.createBitmap(subsampledBitmap, 0, 0, subsampledBitmap
            .getWidth(), subsampledBitmap.getHeight(), m, true);
    if (finalBitmap != subsampledBitmap) {
        subsampledBitmap.recycle();
    }
    return finalBitmap;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:37,代码来源:BaseImageDecoder.java

示例4: considerExactScaleAndOrientatiton

import com.nostra13.universalimageloader.utils.ImageSizeUtils; //导入方法依赖的package包/类
protected Bitmap considerExactScaleAndOrientatiton(Bitmap subsampledBitmap, ImageDecodingInfo decodingInfo,
                                                   int rotation, boolean flipHorizontal) {
    Matrix m = new Matrix();
    // Scale to exact size if need
    ImageScaleType scaleType = decodingInfo.getImageScaleType();
    if (scaleType == ImageScaleType.EXACTLY || scaleType == ImageScaleType.EXACTLY_STRETCHED) {
        ImageSize srcSize = new ImageSize(subsampledBitmap.getWidth(), subsampledBitmap.getHeight(), rotation);
        float scale = ImageSizeUtils.computeImageScale(srcSize, decodingInfo.getTargetSize(), decodingInfo
                .getViewScaleType(), scaleType == ImageScaleType.EXACTLY_STRETCHED);
        if (Float.compare(scale, 1f) != 0) {
            m.setScale(scale, scale);

            if (loggingEnabled) {
                L.d(LOG_SCALE_IMAGE, srcSize, srcSize.scale(scale), scale, decodingInfo.getImageKey());
            }
        }
    }
    // Flip bitmap if need
    if (flipHorizontal) {
        m.postScale(-1, 1);

        if (loggingEnabled) L.d(LOG_FLIP_IMAGE, decodingInfo.getImageKey());
    }
    // Rotate bitmap if need
    if (rotation != 0) {
        m.postRotate(rotation);

        if (loggingEnabled) L.d(LOG_ROTATE_IMAGE, rotation, decodingInfo.getImageKey());
    }

    Bitmap finalBitmap = Bitmap.createBitmap(subsampledBitmap, 0, 0, subsampledBitmap.getWidth(), subsampledBitmap
            .getHeight(), m, true);
    if (finalBitmap != subsampledBitmap) {
        subsampledBitmap.recycle();
    }
    return finalBitmap;
}
 
开发者ID:jianliaoim,项目名称:talk-android,代码行数:38,代码来源:DiskDecoder.java

示例5: considerExactScaleAndOrientaiton

import com.nostra13.universalimageloader.utils.ImageSizeUtils; //导入方法依赖的package包/类
protected Bitmap considerExactScaleAndOrientaiton(Bitmap subsampledBitmap, ImageDecodingInfo decodingInfo,
		int rotation, boolean flipHorizontal) {
	Matrix m = new Matrix();
	// Scale to exact size if need
	ImageScaleType scaleType = decodingInfo.getImageScaleType();
	if (scaleType == ImageScaleType.EXACTLY || scaleType == ImageScaleType.EXACTLY_STRETCHED) {
		ImageSize srcSize = new ImageSize(subsampledBitmap.getWidth(), subsampledBitmap.getHeight(), rotation);
		float scale = ImageSizeUtils.computeImageScale(srcSize, decodingInfo.getTargetSize(), decodingInfo
				.getViewScaleType(), scaleType == ImageScaleType.EXACTLY_STRETCHED);
		if (Float.compare(scale, 1f) != 0) {
			m.setScale(scale, scale);

			if (loggingEnabled) {
				L.d(LOG_SCALE_IMAGE, srcSize, srcSize.scale(scale), scale, decodingInfo.getImageKey());
			}
		}
	}
	// Flip bitmap if need
	if (flipHorizontal) {
		m.postScale(-1, 1);

		if (loggingEnabled) L.d(LOG_FLIP_IMAGE, decodingInfo.getImageKey());
	}
	// Rotate bitmap if need
	if (rotation != 0) {
		m.postRotate(rotation);

		if (loggingEnabled) L.d(LOG_ROTATE_IMAGE, rotation, decodingInfo.getImageKey());
	}

	Bitmap finalBitmap = Bitmap.createBitmap(subsampledBitmap, 0, 0, subsampledBitmap.getWidth(), subsampledBitmap
			.getHeight(), m, true);
	if (finalBitmap != subsampledBitmap) {
		subsampledBitmap.recycle();
	}
	return finalBitmap;
}
 
开发者ID:Apokrif,项目名称:morse,代码行数:38,代码来源:BaseImageDecoder.java

示例6: considerExactScaleAndOrientatiton

import com.nostra13.universalimageloader.utils.ImageSizeUtils; //导入方法依赖的package包/类
protected Bitmap considerExactScaleAndOrientatiton(Bitmap bitmap, ImageDecodingInfo imagedecodinginfo, int i, boolean flag)
{
    Matrix matrix = new Matrix();
    ImageScaleType imagescaletype = imagedecodinginfo.getImageScaleType();
    if (imagescaletype == ImageScaleType.EXACTLY || imagescaletype == ImageScaleType.EXACTLY_STRETCHED)
    {
        ImageSize imagesize = new ImageSize(bitmap.getWidth(), bitmap.getHeight(), i);
        ImageSize imagesize1 = imagedecodinginfo.getTargetSize();
        com.nostra13.universalimageloader.core.assist.ViewScaleType viewscaletype = imagedecodinginfo.getViewScaleType();
        boolean flag1;
        float f;
        Bitmap bitmap1;
        Object aobj[];
        Object aobj1[];
        if (imagescaletype == ImageScaleType.EXACTLY_STRETCHED)
        {
            flag1 = true;
        } else
        {
            flag1 = false;
        }
        f = ImageSizeUtils.computeImageScale(imagesize, imagesize1, viewscaletype, flag1);
        if (Float.compare(f, 1.0F) != 0)
        {
            matrix.setScale(f, f);
            if (loggingEnabled)
            {
                Object aobj2[] = new Object[4];
                aobj2[0] = imagesize;
                aobj2[1] = imagesize.scale(f);
                aobj2[2] = Float.valueOf(f);
                aobj2[3] = imagedecodinginfo.getImageKey();
                L.d("Scale subsampled image (%1$s) to %2$s (scale = %3$.5f) [%4$s]", aobj2);
            }
        }
    }
    if (flag)
    {
        matrix.postScale(-1F, 1.0F);
        if (loggingEnabled)
        {
            aobj1 = new Object[1];
            aobj1[0] = imagedecodinginfo.getImageKey();
            L.d("Flip image horizontally [%s]", aobj1);
        }
    }
    if (i != 0)
    {
        matrix.postRotate(i);
        if (loggingEnabled)
        {
            aobj = new Object[2];
            aobj[0] = Integer.valueOf(i);
            aobj[1] = imagedecodinginfo.getImageKey();
            L.d("Rotate image on %1$d\260 [%2$s]", aobj);
        }
    }
    bitmap1 = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
    if (bitmap1 != bitmap)
    {
        bitmap.recycle();
    }
    return bitmap1;
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:65,代码来源:BaseImageDecoder.java


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