Skip to content

RoundedCornersTransformation not working  #16

Closed
@leixinstar

Description

@leixinstar

when CenterCrop ,RoundedCornersTransformation not working

Activity

wasabeef

wasabeef commented on Sep 16, 2015

@wasabeef
Owner

@leixinstar

Please tell me your source code.
the following code is sample.

Glide.with(mContext)
  .load(R.drawable.demo)
  .bitmapTransform(new CenterCrop(mContext), new RoundedCornersTransformation(mContext, 100, 0))
  .into(holder.image);
leixinstar

leixinstar commented on Sep 21, 2015

@leixinstar
Author

your code can work ok。
my code is:
Glide.with(context)
.load(realUrl)
.centerCrop()
.placeholder(R.drawable.default_avatar)
.error(R.drawable.default_avatar)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.bitmapTransform(new RoundedCornersTransformation(context,8,0))
.into(imageView);

squeeish

squeeish commented on Sep 25, 2015

@squeeish
Contributor

@wasabeef from what I understand, we cannot use Glide's centerCrop() if we use bitmapTransform?

wasabeef

wasabeef commented on Sep 25, 2015

@wasabeef
Owner

@leixinstar
@squeeish

Yeah..

It can't be used centerCrop if you use the bitmapTransform

leixinstar

leixinstar commented on Oct 9, 2015

@leixinstar
Author

RoundedCornersTransformation and CropTransformation(mContext, 300, 100, CropTransformation.CropType.TOP),how can this two work together?

balavishnu

balavishnu commented on Nov 24, 2015

@balavishnu

Removing centerCrop fixed the issue for me. Thanks

TWiStErRob

TWiStErRob commented on Mar 8, 2016

@TWiStErRob

Check the code of centerCrop/fitCenter/dontTransfrom/bitmapTransform they all call transform. To combine two transformations you need to use the varargs version and forget about the convenience methods:

.transform(new CenterCrop(context), new RoundedTransformation(...))

@wasabeef I think you should update https://github.com/wasabeef/glide-transformations#advanced-step-3 with the information that .centerCrop() in a combined usage becomes new CenterCrop(context) (similar for fitCenter.

felipecsl

felipecsl commented on May 10, 2016

@felipecsl

@TWiStErRob that doesn't work either, same results

felipecsl

felipecsl commented on May 10, 2016

@felipecsl

OK I was able to make it work by tweaking RoundedCornersTransformation. In the transform() method, you should use outWidth and outHeight instead of the source bitmap width/height

added a commit that references this issue on May 10, 2016
975a672
TWiStErRob

TWiStErRob commented on May 11, 2016

@TWiStErRob

Sorry, I was wrong about .transform(...) I always forget that @wasabeef's transformations are Transformation<Bitmap> and not BitmapTransformation, using .bitmapTransform(...) works as expected, see #40 (comment).

qibin0506

qibin0506 commented on Jul 6, 2016

@qibin0506

In Adapter, sometime it is ok, but sometime, not, my code :

 if(opts.getRadius() != 0) {
            builder.bitmapTransform(new FitCenter(imageView.getContext()),
                    new RoundedCornersTransformation(imageView.getContext(),
                            opts.getRadius(), 0));
        }else {
            builder.bitmapTransform(new FitCenter(imageView.getContext()));
        }

7 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @felipecsl@wasabeef@leixinstar@TWiStErRob@squeeish

        Issue actions

          RoundedCornersTransformation not working · Issue #16 · wasabeef/glide-transformations