1. COMPUTER GRAPHICS
UNIT-1
Pixels And Aspect Ratio
1
By
Prof. Phadtare Tushar
JSPM’s
Bhivarabai Sawant Institute of Technology & Research,
Wagholi, Pune
Department of Computer Engineering
2. JSPM’s
Bhivarabai Sawant Institute of Technology and Research,
Wagholi,Pune-412207
Department of Computer Engineering
• Departmental Vision
Empowering the students to be professionally competent &
socially responsible for techno-economic development of society.
• Departmental Mission
To provide quality education enabling students for higher
studies, research and entrepreneurship
To inculcate professionalism and ethical values through day
to day practices.
2
3. • Institute Vision
"Satisfy the aspirations of youth force, who want to lead
nation towards prosperity through techno-economic
development."
• Institute Mission
To provide, nurture and maintain an environment of high
academics excellence, research and entrepreneurship
for all aspiring students, which will prepare them to face
global challenges maintaining high ethical and moral
standards."
3
JSPM’s
Bhivarabai Sawant Institute of Technology and Research,
Wagholi,Pune-412207
Department of Computer Engineering
4. CO’s
1) To explore the principles of Object Oriented Programming
(OOP).
4
1 To understand structure & operation of various hardware devices and to
recognize file formats & graphics libraries used in computer graphics
2 To understand and analyze different scan conversion algorithms
3
To implement polygon filling, windowing and clipping algorithms and
compare their performance
4 To interpret, use 2D and 3D geometric transformations.
5
To apply techniques of hidden surfaces, light effects, shading, curve
generation and fractals in construction of natural objects.
6
To experiment advanced animations and gaming techniques to create
animation by using modern graphics tools. .
5. Pixels
The computer stores and displays pixels, or
picture elements.
A pixel is the smallest addressable part of the
computer screen.
A pixel is stored as a binary code representing a
colour.
The code for a pixel can have between
1 and 32 bits of binary code.
5
6. Pixels Example
Here is the Photoshop logo at normal size.
Here it is enlarged 400% so that you can see the
individual pixels.
6
7. Pixel Depth
Pixel Depth describes the number of bits used to
store each pixel.
The greater the pixel depth, the more colours a
pixel can have.
Colour graphics vary in realism depending on
resolution and pixel depth.
The greater the pixel depth, the bigger the file.
7
8. Examples of Pixel Depth Monochrome
Monochrome graphics have one-bit pixel
depth. (pure black or pure white)
8
9. Examples of Pixel Depth Gray-Scale
• Gray-Scale graphics have more bit-depth
(No colours besides black, white and grey)
9
10. Examples of Pixel Depth 8 Bit Colour
• 8 bits per pixel provides 256 colour choices
(Typical of the web - that’s why web graphics need some skilful
preparation)
10
11. Examples of Pixel Depth
• 24 or 32 bits per pixel provides thousands or millions of
colour choices. (Typical of graphics and games software)
11
12. How do we store this?
We would like to allocate memory to hold
the results of the computation stage. 12
13. Framebuffer
Framebuffer - A block of memory,
dedicated to graphics output, that holds
the contents of what will be displayed.
Pixel - one element of the framebuffer
13
14. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Framebuffer
Questions:
• How much memory do we need to allocate for the framebuffer?
• How many pixels are there?
• How big is the framebuffer?
• What is the largest image you can display? 14
15. Resolution
Resolution refers to the density of dots on the
screen or printed image and directly affects
quality
The higher the resolution, the less jagged the
image.
Resolution is measured in DPI (Dots per Inch)
(The printing industry is largely unmetricated and still uses inches
because printing measures such as the Point (1 72nd of an inch) do
not easily convert to metric units.)
The higher the resolution, the better the potential
output.
15
16. Typical Resolutions
Screens generally operate at around 72-100 dpi
Printed images range from 300 to 2400 dpi
Resolution affects the file size of an image.
The higher the resolution, the bigger the file.
The visible resolution is limited to the maximum
possible on the output device (screen or printer).
No matter how high the resolution of a
photograph, it will show at the resolution of your
screen or printer.
16
17. Aspect Ratio
Aspect ratio: the ratio of the rectangle’s width
and height If different in Orthogonal and Window
Size – undesirable side effects caused by the
independence of object, viewing parameters and
workstation window specifications Concept of a
VIEWPORT
17
18. Scan Conversion (Rasterization )
Convert high-level geometry description to pixel colors
in the frame buffer
Example: given vertex x, y coordinates determine pixel
colors to draw line
Two ways to create an image:
– Scan existing photograph
– Procedurally compute values (rendering)
Viewport
Transformation
Rasterization
18
19. Rasterization
A fundamental computer graphics function
Determine the pixels’ colors, illuminations, textures, etc.
Implemented by graphics hardware
Rasterization algorithms
– Lines
– Circles
– Triangles
– Polygons
19
20. Rasterization Operations
• Drawing lines on the screen
• Manipulating pixel maps (pixmaps):
copying, scaling, rotating, etc
• Compositing images, defining and
modifying regions
• Drawing and filling polygons
– Previously glBegin(GL_POLYGON), etc
• Aliasing and antialiasing methods
20