W3C home > Mailing lists > Public > public-html@w3.org > July 2011

[Bug 13261] New: Canvas Clipping

From: <bugzilla@jessica.w3.org>
Date: Thu, 14 Jul 2011 20:31:01 +0000
To: public-html@w3.org
Message-ID: <bug-13261-2495@http.www.w3.org/Bugs/Public/>
http://www.w3.org/Bugs/Public/show_bug.cgi?id=13261

           Summary: Canvas Clipping
           Product: HTML WG
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HTML Canvas 2D Context (editor: Ian Hickson)
        AssignedTo: ian@hixie.ch
        ReportedBy: davidmbradbury@gmail.com
         QAContact: public-html-bugzilla@w3.org
                CC: mike@w3.org, public-html-wg-issue-tracking@w3.org,
                    public-html@w3.org


I'm currently developing a mobile application using the canvas element to be
deployed for Android, iPad, iPhone, and other mobile devices which support the
canvas element. In this application, we are using overhead maps, and to
decrease rendering time, we are cropping these maps with the "context.clip();"
method (originally we had just rendered the whole map and painted over the
outer regions).

This ended up causing some issues, as once you have defined a clipping region,
you cannot modify or otherwise change it. Our solution was to use the
"context.save();" and "context.restore();" before and after our clipping in
order to continue to draw elsewhere, but it seems that there should be either a
way to add to the clipping region (such as setting it to the width/height of
the canvas element as it does when the element is first initiated), or being
able to clear the clip.

I've put together some small examples to demonstrate what we tried, and our
solution:

What we tried - http://jsfiddle.net/v7e32/

Our solution - http://jsfiddle.net/eCegg/

If there are any other question you have, let me know.

David Bradbury

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
Received on Thursday, 14 July 2011 20:31:07 UTC

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:39:26 UTC