There are only a few vector formats:
The *.svg format is open standard vector-based format that used XML tags. It is typically used in map applications (e.g., Google and Yahoo maps). SVG 1.1 became a W3C Recommendation on August 16, 2011.
There are a host of advantages of using SVG over other bitmap formats. It can be:
1 Although SVG can be created with any text editor, it is easier to use a vector-based programs like Adobe Illustrator or Inkscape for complex shapes.
Resource: SVG Tutorial on W3Schools.com
SVG uses a set of instruction in the form of SVG tags to define the "shape" of an image that can be embeded directly into an HTML5 page. Below is a list of shape tags (including text) that can be drawn with SVG:
The line element is used to create a straight line.
<svg width = "200" height = "300"> <line x1 = "10" y1 = "10" x2 = "100" y2 = "200" style = "stroke:rgb(0,0,255); stroke-width:5" /> </svg>
The rect element is used to create a rectangle or square.
<svg width="200" height="300"> <rect width="100" height="200" style="fill:rgb(0,0,255);stroke-width:3; stroke:rgb(255,0,0)">
</svg>
The circle element is used to create a circle.
<svg width="200" height="300"> <circle cx = "100" cy="100" r = "60" stroke = "red" stroke-width = "5" fill = "blue" /> </svg>
The ellipse element is used to create a ellipse. An ellipse can be thought of as a circle that has been compressed. As such, unlike a circle, it has to radius instead of one.
<svg height="200" width="300"> <ellipse cx="120" cy="80" rx="100" ry="50" style="fill:blue;stroke:red; stroke-width:5" /> </svg>
The polyline element is used to create any shape that is composed on only straight lines.
<svg height="200" width="300">
<polyline points="10,10 20,60 30,40 80,70"
style="fill:none;stroke:blue;stroke-width:3" />
</svg>
The polygon element is used to create a polygon (a shape with a least three sides) that is closed unlike the polyline which is not closed.
<svg height="210" width="300"> <polygon points="100,70 150,190 50,190" style="fill:blue;stroke:red;stroke-width:5" />
</svg>
The text element is used to create. While you typically would not want to use SVG to create text, it is best used when you want to transform the text in some way.
<svg height="200" width="300"> <text x="50" y="50" fill="blue" transform="rotate(20 30,40)">SVG is cool! </text> </svg>
The path element is used to create a vector path using the following commands:
Note: All commands can also be expressed with lowercase letters which means relative positioning. Capital letters means absolute positioning.
<svg height="200" width="300"> <path d="M50 50 L150 150 L50 130 Z" />
</svg>
You can style an SVG element with CSS syntax formatting.
Besides the stroke (color) and stroke-width attributes, there are two additionall stroke attributes (stroke-linecap andn stroke-dasharray) that can be applied to an SVG object with an open path:
The stroke-linecap attributes defines different types of endings to an open path. The stroke width has been purposely made big to better see the effects.
<svg height="200" width="300">
<g fill="none" stroke="blue" stroke-width="10">
<path stroke-linecap="butt" d="M5 20 l215 0" />
<path stroke-linecap="round" d="M5 40 l215 0" />
<path stroke-linecap="square" d="M5 60 l215 0" />
</g>
</svg>
Memory Tip: It is helpful to think of the linecap as:
butt is actually no butt
round is a round butt
square is a square butt
The stroke-dasharray attribute is used to create an "array" of dashed:
<svg height="200" width="300">
<g fill="none" stroke="blue" stroke-width="5">
<path stroke-dasharray ="5,5" d="M5 20 l215 0" />
<path stroke-dasharray="10,10" d="M5 40 l215 0" />
<path stroke-dasharray="20,10,5,5,5,10" d="M5 60 l215 0" />
</g>
</svg>
There are a host of filters, similar to what you can do in Adobe Photoshop or Illustrator that can be used to add special effect to a SVG object. You can also add multiple filters to the same object. All filters are defined within a set of defs tags. The <filter> element is used to define the filter that is being used with an id attribute is used to associate the filter with the SVG object.
The example below uses the same rectangle object created earlier with the stroke properties removed. The main differences are:
<svg width="200" height="300">
<defs>
<filter id="myBlurFilter" x="0" y="0">
<feGaussianBlur in="SourceGraphic" stdDeviation="15" />
</filter>
</defs>
<rect x="10" y="10" width="100" height="200" style="fill:rgb(0,0,255)" filter="url(#myBlurFilter)">
</svg>
NOTE:Below is an explanation of the in and stdDeviation attributes:
All filter effects begin with with the prefix "fe." Some of the most common ones include feGaussianBlur, feBlend, and feImage. For a complete list of filter names and additional examples go w3schools.com/svg/.
There are a two types of gradients, similar to what you can do in Adobe Photoshop or Illustrator that can be applied to a SVG object:
The <linearGradient> element is used to define as the name implies a linear gradient within a set of <defs> tags. Linear gradients can be defined is one of three ways:
We will use the previous rectangle example to "add" a linear gradient to it:
<svg width="200" height="300">
<rect x="10" y="10" width="100" height="200" style="fill:rgb(0,0,255)">
</svg>
Here is an example of using SVG with many features applied:
These vector formats are used in print production and by other programs like Photoshop.
PDF is a versatile file format that can contain just about any type of data including complete pages.
Below is a few programs that are used PRIMARILY to create or edit vector images. However, you can import but not create bitmap images inside of them: