Giter Site home page Giter Site logo

Comments (4)

eveliotc avatar eveliotc commented on July 24, 2024 2

Although having output to match view dimensions was intended (literally wysiwyg), agreed that is not ideal and this would be a great enhancement for third party developers, handling original source is a bit of a challenge and we should approach it using subsampling.

from scissors.

soxunyi avatar soxunyi commented on July 24, 2024 1

@nshmura Do best

from scissors.

konecnyna avatar konecnyna commented on July 24, 2024

I would love to have this feature too. The way the current cropping works
is using the viewport dimensions instead of the original bitmap dimensions.

    @Nullable
    public Bitmap crop() {
        if (bitmap == null) {
            return null;
        }


        if (true) {
            return cropFullResolution();
        }

        final Bitmap src = bitmap;
        final Bitmap.Config srcConfig = src.getConfig();
        final Bitmap.Config config = srcConfig == null ? Bitmap.Config.ARGB_8888 : srcConfig;
        final int viewportHeight = touchManager.getViewportHeight();
        final int viewportWidth = touchManager.getViewportWidth();

        final Bitmap dst = Bitmap.createBitmap(viewportWidth, viewportHeight, config);

        Canvas canvas = new Canvas(dst);
        final int left = (getWidth() - viewportWidth) / 2;
        final int top = (getHeight() - viewportHeight) / 2;
        canvas.translate(-left, -top);

        drawBitmap(canvas);

        return dst;
    }

It's using the viewportWidth to create the cropped bitmap which I would think change per the screen density of the phone. Two identical crops on two different phones would have different resolutions.

We have access to the original bitmap in this scope but i'm having trouble trying to translate cropping logic to respect the original bitmap.

from scissors.

dschaller avatar dschaller commented on July 24, 2024

Thank you for you contribution to this repository.

Closing this contribution as this repository is being archived.

from scissors.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.