c4ef56885cf61281835d7c85e710b426e45076e3
[ipdf/sam.git] / chapters / Background_Raster-vs-Vector.tex
1 At a fundamental level everything that is seen on a display device is represented as either a vector or raster image. These images can be stored as stand alone documents or embedded within a more complex document format capable of containing many other types of information.
2
3 A raster image's structure closely matches it's representation as shown on modern display hardware; the image is represented as a grid of filled square ``pixels''. Each pixel is considered to be a filled square of the same size and contains information describing its colour. This representation is simple and also well suited to storing images as produced by cameras and scanners. The drawback of raster images is that by their very nature there can only be one level of detail; this is illustrated in Figures \ref{vector-vs-raster} and \ref{vector-vs-raster-scaled}.
4
5 A vector image contains information about the positioning and shading of geometric shapes. To display this image on modern display hardware, coordinates are transformed according to the view and then the image is converted into a raster like representation. Whilst the raster image merely appears to contain edges, the vector image actually contains information about these edges, meaning they can be displayed ``infinitely sharply'' at any level of detail --- or they could be if the coordinates are stored with enough precision (see Section \ref{Precision and Rounding}). 
6
7 Figures \ref{vector-vs-raster} and \ref{vector-vs-raster-scaled} illustrate the advantage of vector formats by comparing raster and vector images in a similar way to Worth and Packard\cite{worth2003xr}. On the right is a raster image which should be recognisable as an animal defined by fairly sharp edges. Figure \ref{vector-vs-raster-scaled} shows how these edges appear jagged when scaled. There is no information in the original image as to what should be displayed at a larger size, so each square shaped pixel is simply increased in size. A blurring effect will probably be visible in most PDF viewers; the software has attempted to make the ``edge'' appear more realistic using a technique called ``antialiasing''. 
8
9 The left side of the Figures are a vector image. When scaled, the edges maintain a smooth appearance which is limited by the resolution of the display rather than the image itself. %Vector images are well suited to high quality digital art\footnote{Figure \ref{vector-vs-raster} is not to be taken as an example of this.} and text.
10
11
12 \newlength\imageheight
13 \newlength\imagewidth
14 \settoheight\imageheight{\includegraphics{figures/fox-raster.png}}
15 \settowidth\imagewidth{\includegraphics{figures/fox-raster.png}}
16
17 %Height: \the\imageheight
18 %Width: \the\imagewidth
19
20
21 \begin{figure}[H]
22         \centering
23         \includegraphics[scale=0.7528125]{figures/fox-vector.pdf}
24         \includegraphics[scale=0.7528125]{figures/fox-raster.png}
25         \caption{Original Vector and Raster Images}\label{vector-vs-raster}
26 \end{figure} % As much as I hate to break up the party, these fit best over the page (at the moment)
27 \begin{figure}[H]
28         \centering
29         \includegraphics[scale=0.7528125, viewport=210 85 280 150,clip, width=0.45\textwidth]{figures/fox-vector.pdf}
30         \includegraphics[scale=0.7528125, viewport=0 85 70 150,clip, width=0.45\textwidth]{figures/fox-raster.png}
31         \caption{Scaled Vector and Raster Images}\label{vector-vs-raster-scaled}
32 \end{figure}

UCC git Repository :: git.ucc.asn.au