How to fill the intersection of two objects in Fabric.js?

I use Fabric.js to create a simple drawing application. One of the possibilities I'm having problems with is the Bucket Tool.

Objects can be filled with color using Fabric.js with canvas.item(0).fill = "red" However, I want to be able to fill the intersection [C] of two objects [A, B].

Example

Does anyone know how to achieve this? I searched for examples and tutorials on how to implement this, and many point to "Flood Fill," but I don't think it can be implemented using Fabric.js

Any help would be greatly appreciated!

+4
source share
1 answer

, . , , , . .

, , . javascript, , question.

+2

Source: https://habr.com/ru/post/1525857/


All Articles