Hacker News new | ask | show | jobs
by nekoZonbi 5500 days ago
To add a quick but slightly more detailed clarification, between the concepts of Canvas as bitmap and SVG as vectors:

An image in HTML canvas, is stored as a matrix of pixels. Individual pixels in the matrix, can be accessed and modified with canvas API methods.

The canvas drawing API allows to draw vector graphic primitives on the canvas, but these are immediatly rasterized as pixels. So the image is always a bitmap.

In SVG, an image is stored as a set of graphics primitives. There is a primitive that can hold external bitmap images. But there is no way to read or modify individual pixels. Only parameters in the primitive definition can be accessed.

In the Canvas it is possible to operate directly over pixels. In SVG only the mathematical definitions of the shapes primitives can be modified. So complex pixel procesing algorithms are possible with Canvas, but not with SVG.