Giter Site home page Giter Site logo

I'd like to transplant this. about cropper HOT 3 CLOSED

nealehardt avatar nealehardt commented on September 26, 2024
I'd like to transplant this.

from cropper.

Comments (3)

NealEhardt avatar NealEhardt commented on September 26, 2024

Hi there,

I think that's a great idea. JavaScript has much less overhead than Java - people would probably start using it. You are welcome to copy it and use it for anything, including profit. I plan to explicitly add a copyleft license at some point.

As far as the task of porting goes, I think it can be done. MainPanel.form needs to be implemented in HTML. The tricky bit is that this application uses several threads: UI, slow repainter, segmenter updater, and save/load. JavaScript is not great with multithreading. JS only has a UI thread (or queue), so the convention is to break background tasks into small, queueable events so the UI isn't blocked. Save/load tasks can likely be handled by an external async library. The slow repainter can be implemented in the UI queue with repeated calls to setTimeout. The segmenter updater will be most difficult to port, but luckily its work is already in queue form.

So yes, I think it's reasonable to do it. I'll be around if you have any questions.

from cropper.

zgldh avatar zgldh commented on September 26, 2024

I'm glad your approval. It's a great tool, so I think it should be well known someday. Thousands future applications need this feature.

As you mentioned the multithreading, it can be implemented by Web Worker.

Thanks for your advice.

from cropper.

NealEhardt avatar NealEhardt commented on September 26, 2024

You're right, it looks like web workers have pretty good browser support, except for Android before 4.4 (1 year ago).

But WebGL can't be used in a worker, so images need to be passed back and forth as JSON. The best way is probably a 2D array of numbers, where each number is a 32-bit integer representing a single pixel's color 0xAARRGGBB.

Most of Segmenter.java will be done in a single worker. The user's image and annotations are passed in as new Segmenter(image), then user paint is passed in as addControlPoint(x, y, isPositive) and the image is returned with its alpha channel altered, along with the edge path to be traced on screen.

I guess I'll close this issue since you have permission.

from cropper.

Related Issues (1)

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.