tags:

views:

64

answers:

4

I am a junior developer I can't understand how canvas tag is beneficial for us? I read lot of articles on that but I can't get the root benefit getting from the canvas tag.

+3  A: 

Basically, thanks to canvas, we can now draw/render 2D shapes using HTML5 and the canvas API.

As an example of what's possible now with canvas, see this

Soufiane Hassou
+1  A: 

Think of the difference between canvas and svg as the difference betwee Photoshop and Illustrator (or Gimp and Inkscape for you OSS folks). One deals with bitmaps and the other vector art.

With canvas, since you are drawing in bitmap, you can smudge, blur, burn, dodge your images easily. But since it's bitmap you can't easily draw a line and then decide to reposition the line. You need to delete the old line and then draw a new line.

With svg, since you are drawing vectors, you can easily move, scale, rotate, reposition, flip your drawings. But since it's vectors you can't easily blur the edges according to line thickness or seamlessly meld a red circle into a blue square. You need to simulate blurring by drawing intermediate polygons between objects.

Sometimes their use case overlaps. Like a lot of people use canvas to do simple line drawings and keep track of the objects as data structures in javascript. But really, they both serve different purposes. If you try to implement general purpose vector drawing in pure javascript on top of canvas I doubt you'd be faster than using svg which is most likely implemented in C.

slebetman
+1  A: 

The canvas will enable you to draw pixel perfect graphics.

joshua
As opposed to...?
eyelidlessness
+1  A: 

Some possible uses for Canvas:

  • Image drawing program
  • Photo editing/manipulation
  • 2D Games
  • Advanced image viewing such as Microsoft's Deep Zoom

If you can't understand how it's beneficial, then maybe it isn't from your point of view at least. Don't think that because it's there I have to use it somehow, pick and choose what technologies work for you based on what you're trying to build, an Accounting web app probably wouldn't need a canvas for instance.

Sunday Ironfoot