Skip to content

Bug- #34

Description

@AnBetter2021

[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);
    }
    

    }

Activity

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

      Issue actions