Skip to content

Quick Question #2

@dud3

Description

@dud3

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.

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