Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug- #34

Open
AnBetter2021 opened this issue May 10, 2021 · 0 comments
Open

Bug- #34

AnBetter2021 opened this issue May 10, 2021 · 0 comments

Comments

@AnBetter2021
Copy link

[BUG]
尊敬的开发者你好:

  • Bug
    1、 ImageCroppingActivity中Left Top crop of the horizontal image、Left Center crop of the horizontal image、Left Top crop of the horizontal image,发现三种裁剪和显示方式都是一样的。没有任何区别。
    2、Right Top crop of the horizontal image、Right Center crop of the horizontal image、Right Top crop of the horizontal image三种裁剪和显示方式都是一样的,没有任何区别。
    3、请检查是否裁剪算法错误。未实现标注的裁剪和显示方式
    com.codeforvictory.android.superimageview.crop.ImageTransformation
    void compute(@CropType int cropType) {
    int viewWidth = view.getWidth() - view.getPaddingLeft() - view.getPaddingRight();
    int viewHeight = view.getHeight() - view.getPaddingTop() - view.getPaddingBottom();

    if (cropType != CropType.NONE && viewHeight > 0 && viewWidth > 0) {
        Matrix matrix = compatMatrix.matrix(cropType);
    
        Drawable drawable = view.getDrawable();
        int drawableWidth = drawable.getIntrinsicWidth();
        int drawableHeight = drawable.getIntrinsicHeight();
    
        float scaleY = (float) viewHeight / (float) drawableHeight;
        float scaleX = (float) viewWidth / (float) drawableWidth;
        float scale = scaleX > scaleY ? scaleX : scaleY;
        matrix.setScale(scale, scale); // Same as doing matrix.reset() and matrix.preScale(...)
    
        boolean verticalImageMode = scaleX > scaleY;
    
        float xTranslation = getXTranslation(
            cropType,
            viewWidth,
            drawableWidth * scale,
            verticalImageMode
        );
        float yTranslation = getYTranslation(
            cropType,
            viewHeight,
            drawableHeight * scale,
            verticalImageMode
        );
    
        matrix.postTranslate(xTranslation, yTranslation);
        view.setImageMatrix(matrix);
    }
    

    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant