This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 13261 - Canvas Clipping
Summary: Canvas Clipping
Status: RESOLVED NEEDSINFO
Alias: None
Product: HTML WG
Classification: Unclassified
Component: LC1 HTML Canvas 2D Context (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-14 20:31 UTC by David Bradbury
Modified: 2011-08-11 02:31 UTC (History)
4 users (show)

See Also:


Attachments

Description David Bradbury 2011-07-14 20:31:01 UTC
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
Comment 1 Ian 'Hixie' Hickson 2011-07-26 03:07:54 UTC
The way to clear the clip is to save() before it and restore() after it. I don't understand the problem. Can yo elaborate on why that isn't sufficient?
Comment 2 Michael[tm] Smith 2011-08-04 05:03:46 UTC
mass-move component to LC1
Comment 3 Ian 'Hixie' Hickson 2011-08-11 02:31:47 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Did Not Understand Request
Change Description: no spec change
Rationale: see comment 1