The default bug view has changed. See this FAQ.

Extend Canvas compositing with blend modes

RESOLVED FIXED in mozilla20

Status

()

Core
Canvas: 2D
--
enhancement
RESOLVED FIXED
5 years ago
3 years ago

People

(Reporter: Rik Cabanier (don't use this account), Assigned: Rik Cabanier)

Tracking

({dev-doc-complete})

Trunk
mozilla20
x86_64
All
dev-doc-complete
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [DocArea=Canvas])

Attachments

(2 attachments, 5 obsolete attachments)

I work for Adobe and am working on extending CSS and Canvas with blend modes such as overlay, color-burn, hue, etc.
As part of getting this accepted for the Canvas spec, I need to put an experimental version in a couple of browser. 
I'm working on getting this submitted to WebKit but also want to add it for FireFox.

I already have made the necessary changes to the mozilla code base that implement this. (It was easy since the blending modes are already there.)

The formulas for the blending modes are documented here: https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#blending
and a proposal for canvas here: https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#canvascompositingandblending
Status: UNCONFIRMED → NEW
Ever confirmed: true
Created attachment 618428 [details] [diff] [review]
this patch implements blending in canvas for software and core graphics
(Reporter)

Updated

5 years ago
Attachment #618428 - Attachment is obsolete: true
Created attachment 618429 [details] [diff] [review]
this patch implements blending in canvas for software and core graphics
(Reporter)

Updated

5 years ago
Attachment #618429 - Attachment is patch: true
(Reporter)

Updated

5 years ago
Attachment #618429 - Attachment is obsolete: true
Created attachment 618432 [details] [diff] [review]
this patch implements blending in canvas for software and core graphics
(Reporter)

Updated

5 years ago
Attachment #618432 - Flags: review?(jmuizelaar)
Comment on attachment 618432 [details] [diff] [review]
this patch implements blending in canvas for software and core graphics

Review of attachment 618432 [details] [diff] [review]:
-----------------------------------------------------------------

In principle this seems ok. I'd like to see how it works out with D2D before we land it though. It will also need tests.
Attachment #618432 - Flags: review?(jmuizelaar) → review+
We will provide the tests for the W3C.
Either FF or Adobe could add them to your test suite.
There's a conversation on the WebGL mailing list that talks about this: https://www.khronos.org/webgl/public-mailing-list/archives/1205/msg00115.html
I think it is possible to implement this in a similar way in Direct3D.

Looking at your code, you always seem to have access to the Direct3D world so you could set up an  intermediate texture to do the blending.
Also, if you want to special case win8, blending is supported natively there: http://msdn.microsoft.com/en-us/library/windows/desktop/hh706313(v=vs.85).aspx
(Assignee)

Updated

4 years ago
Blocks: 809927
(Assignee)

Comment 8

4 years ago
Created attachment 679769 [details] [diff] [review]
patch for CG and software. Direct2D to follow as separate patch

Once this patch is approved, I can implement the patch for Direct2D
Attachment #679769 - Flags: review?(jmuizelaar)
(Assignee)

Updated

4 years ago
Attachment #679769 - Attachment is patch: true
(Assignee)

Updated

4 years ago
Attachment #679769 - Flags: review?(jmuizelaar)
(Assignee)

Updated

4 years ago
No longer blocks: 809927
Depends on: 809927
(Assignee)

Comment 9

4 years ago
Created attachment 682952 [details] [diff] [review]
Adds support for blending to canvas. 809927 needs to be submitted first
Attachment #682952 - Flags: review?(jmuizelaar)
(Assignee)

Updated

4 years ago
Attachment #679769 - Attachment is obsolete: true
(Assignee)

Updated

4 years ago
Attachment #682952 - Attachment is patch: true
(Assignee)

Comment 10

4 years ago
Created attachment 683278 [details] [diff] [review]
Tests for canvas blending
Attachment #683278 - Flags: review?(jmuizelaar)
(Assignee)

Updated

4 years ago
Attachment #682952 - Attachment is obsolete: true
Attachment #682952 - Flags: review?(jmuizelaar)
(Assignee)

Updated

4 years ago
Attachment #682952 - Attachment is obsolete: false
(Assignee)

Updated

4 years ago
Attachment #683278 - Attachment is obsolete: true
Attachment #683278 - Flags: review?(jmuizelaar)
(Assignee)

Updated

4 years ago
Attachment #682952 - Flags: review?(jmuizelaar)
(Assignee)

Comment 11

4 years ago
Created attachment 683307 [details] [diff] [review]
Added testfiles for Canvas Blending
Comment on attachment 682952 [details] [diff] [review]
Adds support for blending to canvas. 809927 needs to be submitted first

Review of attachment 682952 [details] [diff] [review]:
-----------------------------------------------------------------

This seems fine.
Attachment #682952 - Flags: review?(jmuizelaar) → review+
(Assignee)

Updated

4 years ago
Attachment #683307 - Flags: review?(jmuizelaar)
Keywords: checkin-needed
(Reporter)

Updated

4 years ago
Attachment #618432 - Attachment is obsolete: true
Pushed to Try:
https://tbpl.mozilla.org/?tree=Try&rev=ee59dfe33091
This should wait for the tests to be r+ed
Keywords: checkin-needed
(Assignee)

Comment 15

4 years ago
(In reply to Jeff Muizelaar [:jrmuizel] from comment #14)
> This should wait for the tests to be r+ed

Can you review the tests?
(In reply to Jeff Muizelaar [:jrmuizel] from comment #14)
> This should wait for the tests to be r+ed

Looks like the tests are failing (see the Windows opt/debug mochitest-1 results).
(Assignee)

Updated

4 years ago
Attachment #683307 - Attachment description: Fixed makefile → Added testfiles for Canvas Blending
Earlier today I pushed this to try w/ updated patch from bug 809927, at cabanier's request:
  https://tbpl.mozilla.org/?tree=Try&rev=1eb5097847b3
Looks like we've still got some Win opt/debug mochitest-1 failures.
Pushed to Try with an updated patch from bug 809927:
https://tbpl.mozilla.org/?tree=Try&rev=b3fb0a2665ab
(Assignee)

Updated

4 years ago
Flags: needinfo?(ryanvm)
New Try run: https://tbpl.mozilla.org/?tree=Try&rev=c50a7872fa9d
Flags: needinfo?(ryanvm)
Comment on attachment 683307 [details] [diff] [review]
Added testfiles for Canvas Blending

Review of attachment 683307 [details] [diff] [review]:
-----------------------------------------------------------------

I was hoping to review this before going on vacation but I didn't get a chance to. I'll be back in about a week. If you're in a hurry you can try to get someone else to review it.
(Assignee)

Updated

4 years ago
Flags: needinfo?(ryanvm)
https://tbpl.mozilla.org/?tree=Try&rev=7f6e86970acc
Flags: needinfo?(ryanvm)
(Assignee)

Updated

4 years ago
Flags: needinfo?(ryanvm)
https://tbpl.mozilla.org/?tree=Try&rev=245d38c91824
Flags: needinfo?(ryanvm)
Attachment #683307 - Flags: review?(jmuizelaar) → review+
http://hg.mozilla.org/integration/mozilla-inbound/rev/3a8b188873f8
http://hg.mozilla.org/integration/mozilla-inbound/rev/362510d94a1b
https://hg.mozilla.org/mozilla-central/rev/3a8b188873f8
https://hg.mozilla.org/mozilla-central/rev/362510d94a1b
Assignee: nobody → cabanier
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
Has this been discussed in the WHATWG?
(Assignee)

Comment 26

4 years ago
(In reply to :Ms2ger from comment #25)
> Has this been discussed in the WHATWG?

yes. I brought this up a while ago. Ian advised that the best course of action was to get it in the browsers.
WebKit already is parsing the new keywords and I have a patch ready for Safari to implement this.

In addition, there are more recent discussion about these new property values on public-fx and webkit-dev.

Updated

4 years ago
Severity: normal → enhancement
Keywords: dev-doc-needed
Whiteboard: [DocArea=Canvas]
Reference page:
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.globalCompositeOperation
Release notes:
https://developer.mozilla.org/en-US/Firefox/Releases/20#DOM.2FAPIs
Keywords: dev-doc-needed → dev-doc-complete
You need to log in before you can comment on or make changes to this bug.