jp.wasabeef.picasso.transformations.BlurTransformation Java Examples
The following examples show how to use
jp.wasabeef.picasso.transformations.BlurTransformation.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImageLoader.java From Retrofit2SampleApp with MIT License | 5 votes |
@Override public void loadImage(String url,final ImageView imageView) { Picasso.with(imageView.getContext()).load(url).transform(new Transformation() { @Override public Bitmap transform(Bitmap source) { Bitmap combinedBitmap; combinedBitmap = Bitmap.createBitmap(source.getWidth(), source.getHeight() / 3 + source.getHeight(), source.getConfig()); Canvas combinedCanvas = new Canvas(combinedBitmap); combinedCanvas.drawBitmap(source, 0f, 0f, null); Matrix matrix = new Matrix(); matrix.postRotate(180); matrix.preScale(-1, 1); matrix.postTranslate(0, source.getHeight() * 2); BlurTransformation blurTransformation = new BlurTransformation(imageView.getContext(), 15, 1); Bitmap bottom = blurTransformation.transform(source); combinedCanvas.setMatrix(matrix); combinedCanvas.drawBitmap(bottom, 0f, 0f, null); return combinedBitmap; } @Override public String key() { return ImageLoader.class.getName() + ".Transformation"; } }).error(android.R.drawable.sym_contact_card).placeholder(android.R.drawable.sym_contact_card). into(imageView); }
Example #2
Source File: PicassoLoader.java From ImageLoader with Apache License 2.0 | 4 votes |
private void setShapeModeAndBlur(SingleConfig config, RequestCreator request) { int shapeMode = config.getShapeMode(); List<Transformation> transformations = new ArrayList<>(); if(config.isCropFace()){ //transformations.add(new FaceCenterCrop(config.getWidth(), config.getHeight()));//脸部识别 } if(config.isNeedBlur()){ transformations.add(new BlurTransformation(GlobalConfig.context,config.getBlurRadius())); } switch (shapeMode){ case ShapeMode.RECT: if(config.getBorderWidth()>0){ } break; case ShapeMode.RECT_ROUND: transformations.add(new RoundedCornersTransformation( config.getRectRoundRadius(), 0, RoundedCornersTransformation.CornerType.ALL)); if(config.getBorderWidth()>0){ } if(config.isGif() && config.getRoundOverlayColor()>0){ } break; case ShapeMode.OVAL: transformations.add(new CropCircleTransformation()); if(config.getBorderWidth()>0){ } if(config.isGif() && config.getRoundOverlayColor()>0){ } break; } if(transformations.size()>0){ request.transform(transformations); } }