/**
* Constructs a BitmapContainer object.
* @param bitmap The final bitmap (if it exists).
* @param requestUrl The requested URL for this container.
* @param cacheKey The cache key that identifies the requested URL for this container.
*/
public ImageContainer(Bitmap bitmap, String requestUrl,
String cacheKey, ImageListener listener) {
mBitmap = bitmap;
mRequestUrl = requestUrl;
mCacheKey = cacheKey;
mListener = listener;
}
java类android.graphics.Bitmap的实例源码
ImageLoader.java 文件源码
项目:GitHub
阅读 38
收藏 0
点赞 0
评论 0
MemoryCache.java 文件源码
项目:youth-health
阅读 33
收藏 0
点赞 0
评论 0
public Bitmap get(String id){
try{
if(!cache.containsKey(id))
return null;
return cache.get(id);
}catch(NullPointerException ex){
ex.printStackTrace();
return null;
}
}
ACache.java 文件源码
项目:RLibrary
阅读 39
收藏 0
点赞 0
评论 0
@SuppressWarnings("deprecation")
private static Drawable bitmap2Drawable(Bitmap bm) {
if (bm == null) {
return null;
}
return new BitmapDrawable(bm);
}
BlueTapeDslTest.java 文件源码
项目:BlueTape
阅读 24
收藏 0
点赞 0
评论 0
@Test
public void imageBitmap() throws Exception {
// Given
ImageView imageView = mock(ImageView.class);
Bitmap bitmap = mock(Bitmap.class);
// When
BlueTapeDsl
.imageBitmap(bitmap)
.bind(imageView);
// Then
verify(imageView).setImageBitmap(bitmap);
}
NoiseEffect.java 文件源码
项目:Depth
阅读 28
收藏 0
点赞 0
评论 0
public NoiseEffect(Bitmap bitmap, int grainFPS, float scale) {
super(bitmap, 0, 0);
shader = new BitmapShader(bitmap, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
matrix = new Matrix();
shader.setLocalMatrix(matrix);
paint.setShader(shader);
paint.setAlpha(144);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SCREEN));
lastGrainOffset = System.currentTimeMillis();
this.grainFPS = grainFPS;
this.scale=scale;
}
WidgetPreviewLoader.java 文件源码
项目:FlickLauncher
阅读 39
收藏 0
点赞 0
评论 0
private Bitmap generatePreview(Launcher launcher, WidgetItem item, Bitmap recycle,
int previewWidth, int previewHeight) {
if (item.widgetInfo != null) {
return generateWidgetPreview(launcher, item.widgetInfo,
previewWidth, recycle, null);
} else {
return generateShortcutPreview(launcher, item.activityInfo,
previewWidth, previewHeight, recycle);
}
}
BaseImageDecoder.java 文件源码
项目:GitHub
阅读 27
收藏 0
点赞 0
评论 0
/**
* Decodes image from URI into {@link Bitmap}. Image is scaled close to incoming {@linkplain ImageSize target size}
* during decoding (depend on incoming parameters).
*
* @param decodingInfo Needed data for decoding image
* @return Decoded bitmap
* @throws IOException if some I/O exception occurs during image reading
* @throws UnsupportedOperationException if image URI has unsupported scheme(protocol)
*/
@Override
public Bitmap decode(ImageDecodingInfo decodingInfo) throws IOException {
Bitmap decodedBitmap;
ImageFileInfo imageInfo;
InputStream imageStream = getImageStream(decodingInfo);
if (imageStream == null) {
L.e(ERROR_NO_IMAGE_STREAM, decodingInfo.getImageKey());
return null;
}
try {
imageInfo = defineImageSizeAndRotation(imageStream, decodingInfo);
imageStream = resetStream(imageStream, decodingInfo);
Options decodingOptions = prepareDecodingOptions(imageInfo.imageSize, decodingInfo);
decodedBitmap = BitmapFactory.decodeStream(imageStream, null, decodingOptions);
} finally {
IoUtils.closeSilently(imageStream);
}
if (decodedBitmap == null) {
L.e(ERROR_CANT_DECODE_IMAGE, decodingInfo.getImageKey());
} else {
decodedBitmap = considerExactScaleAndOrientatiton(decodedBitmap, decodingInfo, imageInfo.exif.rotation,
imageInfo.exif.flipHorizontal);
}
return decodedBitmap;
}
ImageUtils.java 文件源码
项目:GitHub
阅读 38
收藏 0
点赞 0
评论 0
/**
* 获取bitmap
*
* @param resId 资源id
* @return bitmap
*/
public static Bitmap getBitmap(@DrawableRes final int resId) {
Drawable drawable = ContextCompat.getDrawable(Utils.getApp(), resId);
Canvas canvas = new Canvas();
Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
canvas.setBitmap(bitmap);
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
drawable.draw(canvas);
return bitmap;
}
ImageStateDisplay.java 文件源码
项目:empty-state-recyclerview
阅读 31
收藏 0
点赞 0
评论 0
public void resizeImage(int width, int height) {
if (image == null) {
throw new NullPointerException("Please set an image before calling resizeImage()!");
}
this.image = Bitmap.createScaledBitmap(image, width, height, false);
invalidateImage();
}
BitmapHunterTest.java 文件源码
项目:GitHub
阅读 31
收藏 0
点赞 0
评论 0
@Test public void huntDecodesWhenNotInCache() throws Exception {
Action action = mockAction(URI_KEY_1, URI_1, mockImageViewTarget());
TestableBitmapHunter hunter =
new TestableBitmapHunter(picasso, dispatcher, cache, stats, action, bitmap);
Bitmap result = hunter.hunt();
verify(cache).get(URI_KEY_1);
verify(hunter.requestHandler).load(action.getRequest(), 0);
assertThat(result).isEqualTo(bitmap);
}