Automattic / Automattic/node-canvas

Mask on item over path are not correct.

Open
#504 4 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
JavaScript
Stars
10.7k
Forks
1.2k
Avg merge
4d 8h
Merged PRs (30d)
1

Description

```
ctx.fillStyle = "#FF0000";
ctx.lineTo(0, 100);
ctx.lineTo(100, 100);
ctx.lineTo(100, 0);
ctx.lineTo(0, 0);
ctx.fill();

ctx.save();
ctx.rect(0,0,50,50);
ctx.clip();

ctx.fillStyle = "#00FF00";
ctx.fillRect(0,0,100,100);
ctx.restore();
```

With this code, I'm getting this :
![2015-01-23 15_30_17-hardcoded 500x500](https://cloud.githubusercontent.com/assets/500045/5876129/d0e9d4dc-a314-11e4-957f-4ca8d68defec.png)

But if I don't make a mistake, I should get this :
![2015-01-23 15_25_35-hardcoded 500x500](https://cloud.githubusercontent.com/assets/500045/5876136/e0c41e6c-a314-11e4-9419-4f0d40a4a090.png)

Contributor guide

No contributing guide indexed for this repository

Research direction

Run the provided canvas snippet in node-canvas and compare its clipping output with the expected image. Trace the behavior of save(), rect(), clip(), fillRect(), and restore() to identify where the mask diverges, then confirm the corrected result with the same reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.