开发者

Calculate the blank area of a CANVAS

Help me:

I have a canvas. There are some shapes inside this canvas, these shapes are changing at random over time and they are different types(like: triangle, parallelogram, trapezium, square, circle etc). There are also some blank space/area in that canvas left after these shapes rendered each t开发者_StackOverflowime.

Now how can I calculate that area of blank space of that canvas after each time those shapes are rendered at random?


Subtract the areas of the shapes from the canvas area.

If the shapes do not overlap this is the requested area.

If the shapes overlap you could calculate the overlaps add these back to the previously found area.

If it is too difficult to calculate the areas and overlaps you could go brute force and render the canvas to a bitmap and count colored pixels.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜