fillRect() method of the Canvas 2D API draws a „filled" rectangle at (x, y) position and size by (width, height). The rectangle can be masked with a custom shape by other API methods.