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

Quick Question #2

Open
dud3 opened this issue Oct 27, 2015 · 0 comments
Open

Quick Question #2

dud3 opened this issue Oct 27, 2015 · 0 comments

Comments

@dud3
Copy link

dud3 commented Oct 27, 2015

I have the following code:

            var mousePos = _this.root.getPointer(e.e);
            mousePos.x = parseInt(mousePos.x);
            mousePos.y = parseInt(mousePos.y);
            var width = _this.root.getWidth();
            var height = _this.root.getHeight();
            var pixels = _this.root.getContext().getImageData(0, 0, width, height);
            var pixel = (mousePos.x + mousePos.y * pixels.width) * 4;
            _this.activePathsColor = new fabric['Color']('rgb(' + pixels.data[pixel] + ',' + pixels.data[pixel + 1] + ',' + pixels.data[pixel + 2] + ')');
            var colorHex = '#' + _this.activePathsColor.toHex().toLowerCase();

How would we use getImageDataFaster in this case.

Thanks.

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