Firefox Development Highlights – Per Window Private Browsing & Canvas' globalCompositeOperation new values

On a regular basis, we like to highlight the latest features in Firefox for developers, as part of our Bleeding Edge series, and most examples only work in Firefox Nightly (and could be subject to change).

Per Window Private Browsing

Private browsing is very useful for web developers. A new private session doesn’t include existing persistent data (cookies and HTML5 storage). It’s convenient if we want to test a website that stores data (login and persistent informations) without cleaning every time these cached data, or if we want to login to a service with 2 different users.

Until now, when entering Private Browsing in Firefox, it was closing the existing session to start a new one. Now, Firefox will keep the current session and open a new private window. You can test it in Firefox Nightly (to be Firefox 20). There’s still some frontend work to do, but the feature works.

Canvas’ globalCompositeOperation new values

The ‘globalCompositeOperation’ canvas property lets you define how you want canvas to draw images over an existing image. By default, when canvas draws an image over existing pixels, the new image is just replacing the pixels. But there are other ways to mix pixels. For example, if you set ctx.globalCompositeOperation = "lighter", pixel color values are added, and it creates a different visual effect.

There are several effects available, and more on them can be found in globalCompositeOperation on MDN.

Rik Cabanier from Adobe has extended the Canvas specification to include more effects. He has also implemented these new effects in Firefox Nightly. These new effects are called “blend modes”. These are more advanced ways of mixing colors.

Please take a look at the list of these new blending modes.

And here’s an example of how to use them:

JS Bin demo.

If you don’t use Firefox Nightly, here is a (long) screenshot:

image

About Paul Rouget

Paul is a Firefox developer.

More articles by Paul Rouget…

About Robert Nyman [Editor emeritus]

Technical Evangelist & Editor of Mozilla Hacks. Gives talks & blogs about HTML5, JavaScript & the Open Web. Robert is a strong believer in HTML5 and the Open Web and has been working since 1999 with Front End development for the web - in Sweden and in New York City. He regularly also blogs at http://robertnyman.com and loves to travel and meet people.

More articles by Robert Nyman [Editor emeritus]…


9 comments

  1. Caspy7

    Thanks for the graphical illustration/screenshot.

    December 24th, 2012 at 02:29

  2. k

    So we can make a GIMP-lite using plain CSS now? :-)

    April 3rd, 2013 at 05:45

    1. Robert Nyman [Editor]

      Yeah, go crazy! :-)

      April 3rd, 2013 at 08:11

  3. scootergrisen

    Is it just me or does color-burn and color-dodge give the same result i Firefox 20.0 ?

    April 6th, 2013 at 14:58

  4. Slipp D.

    Just updated to Firefox 20.0 which claims to implement this and links to this post, yet I’m not seeing anything happening in the demo.  Should I report this somewhere? ;-/

    April 8th, 2013 at 00:48

    1. Robert Nyman [Editor]

      Please start by contacting Firefox support. Thanks!

      April 8th, 2013 at 10:08

      1. Slipp D.

        Sounds easy enough.  Cheers.

        April 8th, 2013 at 10:19

  5. Michael Mullany

    Any chance of seeing the new blend modes show up in SVG filters any time soon?

    April 8th, 2013 at 11:07

    1. Robert Nyman [Editor]

      Don’t know more about that right now, unfortunately.

      April 8th, 2013 at 23:55

Comments are closed for this article.