Title: Graphics, Number Systems
1Lecture 6
2Bit-map Graphics
- Similar to real painting on the canvas, there is
no way to change something but paint over it. - Bit-mapped graphics become ragged when you shrink
or enlarge them.
3Painting Bit-Mapped Graphics
- Paint pixels on the screen with a pointing device
- Select painting tools from a tools palette
- Create bit-mapped graphics
- Realism of the images isdetermined by the amount
ofmemory allocation per pixel - Resolution is determinedby the density of pixels
4Painting Bit-Mapped Graphics
- The outlinedareas can befilled with acolor or
witha pattern
5Digital Image ProcessingPhotographic Editing by
Computer
- You can edit high-resolution bit-mapped images
- Select editing toolsfrom a palette
- Alter digitizedphotographs andgraphics from
paintprograms
6Image Formats
- BMP
- The bit-mapped file format used by Microsoft
Windows. - TIFF (Tagged Image File Format)
- A standard file format for storing images as bit
maps. It is used especially for scanned images
because it can support any size, resolution, and
color depth
7Image Formats (cont)
- GIF (Graphics Interchange Format)
- A standard for digitized images compressed with
the LZW algorithm (not image-specific, can be
used for any data, in Unix a command compress).
Allows for features such a transparent
background, animation. Used in the Internet for
small icon-like images.
8Image Formats (cont)
- JPEG (Joint Photographic Experts Group)
- JPEG is designed for compressing either
full-color or gray-scale digital images of
"natural", real-world scenes. It does not work so
well on non-realistic images, such as cartoons or
line drawings. JPEG does not handle compression
of black-and-white (1 bit-per-pixel) images or
moving pictures. Used in the Internet for photos.
9Vector Graphics
- A vector image consist of objects such as lines,
rectangles, circles, etc. that can be easily
moved around and resized. - An object is usually chosen by a mouse click, and
could be resized by dragging its borders. - Objects stay separate from each other all the
time.
10Vector Graphics
- Such properties of an object as line thickness,
color, fill pattern can be easily changed after
the object was created. - Several objects may be grouped in on composed
object. - A composed object can be broken down to the
original objects it was made from. - Objects can be arranged in several layers, so
that they overlap in a defined manner.
11Drawing Object-Oriented Graphics
- Draw the shapesof objects with apointing device
- The paletteof drawingsoftware differsfrom that
ofpainting software
12Drawing Object-Oriented Graphics
- Shapes
- Are stored as formulas (text) describing how to
draw that shape the allows infinite resolution
and requires less memory - The shape formulas allow for infinite resolution
of the image - The shape formulas alsomean fewer memory demands
13Image Formats
- Formats of drawing programs (e.g. xfig)
- PostScript, PDF
- Graphics file format developed by Adobe Systems.
Postscript is widely used on Unix for
distributing and printing documents. Portable
Document Format (PDF) is de-facto standard for
documents in the Internet
14Painting Pixels vs.Drawing Object Shapes
- Painting pixels
- More control over textures,shading and fine
detail - Used to create screendisplays (for videogames,
multimediapresentations, andWeb pages)
15Painting Pixels vs.Drawing Object Shapes
- Painting pixels
- Used for simulatingnatural paint media
- Used to embellishphotographic images
16Painting Pixels vs.Drawing Object Shapes
- Drawing object shapes
- Better choice for creating printed graphs,
charts, and illustrations with clean lines and
smooth shapes
17CAD/CAM From Picturesto Products
- Engineers,architect, and designersuse
(computer-aided design) CADsoftware to designor
manufactureproducts - AutoCAD
18Screen shot
- In Linux it is possible to save an image of whole
display, a fragment of the display or a window
using Grab-feature in the xv-program. - In Windows it is possible to take save an image
of the currently active window by pressing
ltAltgt-ltPrintScreengt, or of the whole display by
pressing just ltPrintScreengt. The image is then
place into clipboard, and can be pasted for
example into a WordPerfect document or into Paint
program.
19Number and Character Representation in Computers
20A Bit About Bits
- A bit (binary digit)
- is the smallest unit of information
- can have two values - 1 and 0.
- Binary digits, or bits, can represent numbers,
codes, or instructions.
On
Off
21Bits as Numbers
- Binary number system - a system that denotes all
numbers and combinations of two digits. - The binary system uses two digits to represent
the numbers 0 and 1.
22Bits, Bytes, and Buzzwords
- Common terms might describe file size or memory
size - Bit smallest unit of information
- Byte a grouping of eight bits of information
- K (kilobyte) about 1,000 bytes of information -
technically 1024 bytes equals 1K of storage.
23Bits, Bytes, and Buzzwords
- MB (megabyte) about 1 million bytes of
information - GB (gigabyte) about 1 billion bytes of
information - TB (terabyte) about 1 million megabytes of
information
24Decimal System
- Humans have 10 fingers count in DECIMAL
- Numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, ... - Use 10 digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
- We know that 5304 5103310201014100
- Base 10
25Binary System
- BINARY numbers
- 0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001,
1010, 1011, .... - Written with only 2 digits "0" and "1"
- In the same way as for decimal, 1011 (binary)
123022121120 11 (decimal) - Base 2
- Converting from binary to decimal is simple, just
as for 1011 above.
26Binary System (contd.)
- How to know if 1011 is in binary or in decimal?
Subscripts are used to show the base 10112
(binary number), 101110 (decimal number) - Converting from decimal to binary a little bit
more tricky, we skip this, check some book if you
are interested. - Large binary numbers are cumbersome to write
27Hexadecimal System
- Heavily used in modern computers to represent
binary data - Numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C,
D, E, F, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
1A, 1B, ... - Base 16
- Again the same idea
- 1A16 116110160 2610
28Hex (cont.)
- Groups of 4 bits
- 4 bits 24 16 combinations... ... use digits
0-9 and A, B, C, D, E, F - Converting between binary and hex is
straightforward - 10111101112 gt 10 1111 0111 gt 10(2)
1111(F) 0111(7) gt 2F716
29Octal System
- Octal was used in computers with byte length of 6
bits - Numbers 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13,
14, 15, 16, 17, 20, ... - Base 8
- Groups of 3 bits
- 3 bits 23 8 combinations... use digits 0-7
30Octal (cont.)
- Converting between binary and octal is
straightforward 10111101112 gt 1 011 110 111 gt
- 1(1) 011(3) 110(6) 111(7) gt13678
- In UNIX chmod command takes absolute mode for
file access rights in octal
31Example
- Decimal Binary
Octal Hex (base 10) (base
2) (base 8) (base 16)
0 0000 0 0
1 0001
1 1 2
0010 2 2
3 0011 3 3
4 0100
4 4 5
0101 5 5
6 0110 6 6
7 0111
7 7 8
1000 10 8
9 1001 11 9
10 1010
12 A 11
1011 13 B
12 1100 14 C
13 1101
15 D 14
1110 16 E
15 1111 17 F - 35 10 0011
43 23 100 110
0100 144 64 255
1111 1111 377 FF
32Bits as Codes
- ASCII - American Standard Code for Information
Interchange - most widely used code, represents
each character as a unique 7-bit code.
33Character Tables
- ISO Latin1
- 8-bit code
- Extension to ASCII (ASCII is compatible)
- Has characters for European languages
- Cyrillic
- A dozen of different encodings
- Mostly used
- KOI8 for UNIX
- Windows-1251
- Unicode (16 bits) includes ALL characters from
ALL languages (!) - Character Sets in browsers