---
title: "ICanvasRenderingContext2D.ClearRect"
url: "https://reference.aspose.com/html/net/aspose.html.dom.canvas/icanvasrenderingcontext2d/clearrect/"
product: "Aspose.HTML for .NET API Reference"
description: "ICanvasRenderingContext2D ClearRect method. Sets all pixels in the rectangle defined by starting point x y and size width height to transparent black erasing any previously drawn content"
---

## ICanvasRenderingContext2D.ClearRect method

Sets all pixels in the rectangle defined by starting point (x, y) and size (width, height) to transparent black, erasing any previously drawn content.

```csharp
public void ClearRect(double x, double y, double w, double h)
```

| Parameter | Type | Description |
| --- | --- | --- |
| x | Double | The x axis of the coordinate for the rectangle starting point. |
| y | Double | The y axis of the coordinate for the rectangle starting point. |
| w | Double | The rectangle's width. |
| h | Double | The rectangle's height. |

### See Also

* interface [ICanvasRenderingContext2D](../)
* namespace [Aspose.Html.Dom.Canvas](../../../aspose.html.dom.canvas/)
* assembly [Aspose.HTML](../../../)
