SlideShare a Scribd company logo
Lecture 9
Graphical Programming
Lecturer: Sumaira Hussain
S.M.I University
COMPUTER GRAPHICS
• Images created with the help of computers
• 2-D and 3-D (displayed on a 2-D screen but in such a
way that they give an illusion of depth)
• Used for scientific research, artistic expression, or
for industrial applications
• Graphics have made the computer interfaces more
intuitive by removing the need to memorize
commands
Graphical Programming
Graphical Programming
DISPLAYING IMAGES
• Most all computer displays consist of a grid of tiny
pixels arranged in a regular grid of rows and
columns
• Images are displayed by assigning different colors to
the pixels located in the desired portion of the
computer display
PIXEL
• The smallest image forming element on a computer
display
• The computer display is made up of a regular grid of
these pixels
• The computer has the capability of assigning any
color to any of the individual pixels on the display
• Let’s now see how the computer displays a square
Graphical Programming
PIXEL COLORS (1)
• The color of each pixel is generally represented in
the form a triplet
• In a popular scheme – the RGB scheme – each part
of the triplet represents the intensity of one of out
of three primary colors: red, green, blue
• Often, the intensity of each color is represented
with a byte, resulting in 256x256x256 (16+ million)
unique color combinations
PIXEL COLORS (2)
• If this scheme is used to display an image that is
equal to the size of an XGA (1024x768 pixels)
display, the image will require 2.25MB of storage,
which is just too much
• A number of clever schemes have been invented to
reduce the number of bytes that are required for
storing graphics. 2 popular ones:
– Color mapping
– Dithering
COLOR MAPPING (1)
• Instead of letting each pixel assume one out of 16
million possible colors, only a limited number of
colors – called the platelet – are allowed
• For example, the platelet may be restricted to 256
colors (requiring 1 byte/pixel instead of 3)
COLOR MAPPING (2)
• Each value, from 0 to 255, is mapped to a selected
RGB color through a table, reducing the size of a
2.25MB graphic to 0.75MB
• The quality of the displayed image will not suffer at
all if the image only uses colors that are a part of
the platelet
COLOR PLATELET EXAMPLE
Color Platelet Code Actual Color in RGB
1 255, 255, 000 (yellow)
2 255, 000, 000 (red)
3 000, 255, 255 (cyan)
4 255, 153, 051 (orange)
… …
… …
… …
DITHERING
• In this scheme, pixels of alternating colors are used
to simulate a color that is not present in the platelet
• For example, red and green pixels can be alternated
to give the impression of bright yellow
• The quality of the displayed image is poorer
ALIASING
• The computer screen consists of square-ish pixels
arranged in a fixed grid
• At times, when a diagonal line is drawn on this grid,
it looks more like a staircase, instead of a straight
line
• This effect – called aliasing – can be managed by
reducing the size of pixels
Graphical Programming
ANTI-ALIASING (1)
• Anti-aliasing is another technique used for
managing the ‘staircase’ effect
• Let’s say that we need to draw a white straight-line
such that it overlaps 60% with one pixel, and 40%
with another initially, and near the end, 58%, 41%,
and 1%, respectively, with three pixels
ANTI-ALIASING (2)
• The staircase effect is caused because the proper
drawing of the line requires a pixel that does not
exist
• There are three options in this case:
– Assign the white color to the pixel corresponding to the
largest overlap
– Assign the white color to both pixels
• Either of these will cause the staircase effect
Graphical Programming
Graphical Programming
ANTI-ALIASING (3)
• The 3rd option is to color the pixel with 60% overlap
to a 40% gray color & the other one to 60% gray
• Result: A smoother - pleasing to the eye - look
Graphical Programming
GRAPHICS FILE FORMATS
The choice of the format generally depends upon
the nature of the image. For example:
– An image of natural scenery contains many irregular,
non-geometric shapes, therefore is stored in bit-map
format
– A CAD drawing consists of many geometric shapes like
straight lines, arcs, etc. and therefore is stored in a vector
format
– A third situation arises when dealing with graphics that
contain both regular and irregular shapes
VECTOR OR OBJECT-ORIENTED GRAPHICS
• Treats everything that is drawn as an object
• Objects retain their identity after they are drawn
• These objects can later be easily moved, stretched,
duplicated, deleted, etc
• Are resolution independent
• Relatively small file size
• Examples: swf, svg, wmf, ps
BIT-MAPPED OR RASTER GRAPHICS
• Treats everything that is drawn as a bit-map
• If an object is drawn on top of another, it is difficult
to move just one of them while leaving the other
untouched
• Changing the resolution often requires considerable
touch-up work
• Relatively large file size
• Examples: gif, jpg, bmp
FILE FORMATS POPULAR ON THE WEB (1)
gif (Graphical Interchange Format)
–Bit-map images compressed using the LZW algo.
–The number of colors is first reduced to 256 and then
consecutive pixels having the same color are encoded
in a [color, numberOfPixels] format
–Works well with computer-generated graphics (e.g.
CAD, block diagrams, cartoons) but not with natural,
realistic images
–Loss-less for images having 256 colors or less
FILE FORMATS POPULAR ON THE WEB (2)
jpg (JPEG – Joint Photographic Experts Group)
–Compressed, full-color and gray-scale bit-map images of
natural, real-world scenes, where most every pixel
differs in color from its neighbor
–It does not work as well as gif with non-realistic images,
such as cartoons or line drawings
–Does not handle compression of B&W images
–Lossy
FILE FORMATS POPULAR ON THE WEB (3)
swf (Shockwave Flash)
– Designed for 2-D animations, but can also be used for storing static
vector images as well
– A special program (called a plug-in) is required to view swf files in a
Web browser
svg (Structured Vector Graphics)
– New format; may become more popular than swf
– Scalable Vector Graphics (SVG) is an XML-based vector image
format for two-dimensional graphics with support for interactivity
and animation. The SVG specification is an open standard
developed by the World Wide Web Consortium (W3C) since 1999.
SVG images and their behaviors are defined in XML text files.
IMAGE PROCESSING
• A branch of computer science concerned with
manipulating and enhancing computer graphics
• Examples:
– Converting 2-D satellite imagery into a 3-D model of a
terrain
– Restoring old, faded photographs into something closer
to the original
– Determining the amount of silting in Tarbela lake from a
satellite image
3-D GRAPHICS (1)
• Flat images enhanced to impart the illusion of
depth
• We perceive the world and the objects in it in 3-D -
breadth, width, depth - although the images formed
on the retinas of our eyes are 2-D
• The secret of 3-D perception: stereo vision
(Computer stereo vision is the extraction of 3D
information from digital images, such as obtained
by a CCD camera.)
3-D GRAPHICS (2)
• The two eyes are spaced a few cm apart
• Result: The images formed on the two retinas are
slightly different
• The brain combines these two into a single 3-D
image, enabling us to perceive depth
3-D GRAPHICS: APPLICATIONS
• Games
• Medical images
• 3-D CAD
3-D RENDERING
• The process of converting information about 3-D
objects into a bit-map that can be displayed on a 2-
D computer display
• Computationally, very expensive!
• Steps:
– Draw the wire-frame (skeleton, made with thin lines)
– Fill with colors, textures, patterns
– Add lighting effects (reflections, shadows)
ANIMATION
• Graphics in motion, e.g. cartoons
• Illusion of motion is created by showing the viewer
a sequence of still images, rapidly
• Drawing those images - each slightly different from
the previous one - used to be quite tedious work
• Computers have helped in cutting down some of
the tediousness
Graphical Programming
1
11
6
10
14 15 16
1312
987
5432
COMPUTER ANIMATION: EXAMPLES
• Games
• Cartoons, movies
• Visualization of processes, e.g the IM process
• Displaying the results of scientific experiments, e.g.
nuclear fusion
TWEENING (1)
• Creating a reasonable illusion of motion requires
the drawing of 14-30 images per second of
animation – very tedious!
• In practice, only 4-5 images (called key images)
instead of 14-30 are drawn, and then the computer
is asked to create the remaining in-between images
TWEENING (2)
• This process of creating these in-between images
from key images is called in-betweening (or
tweening for short)
• The simplest algorithm for tweening calculates the
position of a particular segment of an image by
calculating the average of the positions of that
same image segment belonging to adjacent key
images
THE FUTURE OF GRAPHICS & ANIMATION
• New graphic-file storage formats will appear with
better compression efficiencies
• 3-D animation will become more popular as
computers become faster and algorithms become
smarter
• More realistic games; better realism in movies –
may, one day, make the human actors extinct
Graphical Programming
Ad

More Related Content

What's hot (20)

Algorithm Design & Implementation
Algorithm Design & ImplementationAlgorithm Design & Implementation
Algorithm Design & Implementation
Gaditek
 
Functions Of Operating Systems
Functions Of Operating SystemsFunctions Of Operating Systems
Functions Of Operating Systems
Akshay Kurup
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
Gaditek
 
operating system lecture notes
operating system lecture notesoperating system lecture notes
operating system lecture notes
AVC College of Engineering
 
Introduction to Operating Systems
Introduction to Operating SystemsIntroduction to Operating Systems
Introduction to Operating Systems
Mukesh Chinta
 
Operating system basics
Operating system basicsOperating system basics
Operating system basics
John Carlo Catacutan
 
Peter Norton’s Introduction to Computers
Peter Norton’s Introduction to ComputersPeter Norton’s Introduction to Computers
Peter Norton’s Introduction to Computers
Ujjwal 'Shanu'
 
Types of Programming Languages
Types of Programming LanguagesTypes of Programming Languages
Types of Programming Languages
Juhi Bhoyar
 
Chapter 2 operating systems
Chapter 2 operating systemsChapter 2 operating systems
Chapter 2 operating systems
Praveen M Jigajinni
 
operating system
operating systemoperating system
operating system
KadianAman
 
Algorithm defination, design & Implementation
Algorithm defination, design & ImplementationAlgorithm defination, design & Implementation
Algorithm defination, design & Implementation
Bilal Maqbool ツ
 
Graphical programming
Graphical programmingGraphical programming
Graphical programming
Bilal Maqbool ツ
 
System software
System softwareSystem software
System software
Harsha Sachdeva
 
Unit 1-introduction to scripts
Unit 1-introduction to scriptsUnit 1-introduction to scripts
Unit 1-introduction to scripts
sana mateen
 
Computer software
Computer softwareComputer software
Computer software
Burhan Ahmed
 
Computer Software & It's types.
Computer Software &  It's types.Computer Software &  It's types.
Computer Software & It's types.
Mohit Dhankher
 
Virtual Machine
Virtual MachineVirtual Machine
Virtual Machine
Mehul Boghra
 
Operating Systems & Applications
Operating Systems & ApplicationsOperating Systems & Applications
Operating Systems & Applications
Maulen Bale
 
Introduction to computer hardware
Introduction to computer hardwareIntroduction to computer hardware
Introduction to computer hardware
Elike Ikechukwu
 
Introduction to Computers
Introduction to ComputersIntroduction to Computers
Introduction to Computers
RIAH ENCARNACION
 
Algorithm Design & Implementation
Algorithm Design & ImplementationAlgorithm Design & Implementation
Algorithm Design & Implementation
Gaditek
 
Functions Of Operating Systems
Functions Of Operating SystemsFunctions Of Operating Systems
Functions Of Operating Systems
Akshay Kurup
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
Gaditek
 
Introduction to Operating Systems
Introduction to Operating SystemsIntroduction to Operating Systems
Introduction to Operating Systems
Mukesh Chinta
 
Peter Norton’s Introduction to Computers
Peter Norton’s Introduction to ComputersPeter Norton’s Introduction to Computers
Peter Norton’s Introduction to Computers
Ujjwal 'Shanu'
 
Types of Programming Languages
Types of Programming LanguagesTypes of Programming Languages
Types of Programming Languages
Juhi Bhoyar
 
operating system
operating systemoperating system
operating system
KadianAman
 
Algorithm defination, design & Implementation
Algorithm defination, design & ImplementationAlgorithm defination, design & Implementation
Algorithm defination, design & Implementation
Bilal Maqbool ツ
 
Unit 1-introduction to scripts
Unit 1-introduction to scriptsUnit 1-introduction to scripts
Unit 1-introduction to scripts
sana mateen
 
Computer Software & It's types.
Computer Software &  It's types.Computer Software &  It's types.
Computer Software & It's types.
Mohit Dhankher
 
Operating Systems & Applications
Operating Systems & ApplicationsOperating Systems & Applications
Operating Systems & Applications
Maulen Bale
 
Introduction to computer hardware
Introduction to computer hardwareIntroduction to computer hardware
Introduction to computer hardware
Elike Ikechukwu
 

Similar to Graphical Programming (20)

CS101- Introduction to Computing- Lecture 33
CS101- Introduction to Computing- Lecture 33CS101- Introduction to Computing- Lecture 33
CS101- Introduction to Computing- Lecture 33
Bilal Ahmed
 
Ciencias de la computación, Gráficos por computadora.
Ciencias de la computación, Gráficos por computadora.Ciencias de la computación, Gráficos por computadora.
Ciencias de la computación, Gráficos por computadora.
Watchsoft
 
Chapter 6 Graphics
Chapter 6 GraphicsChapter 6 Graphics
Chapter 6 Graphics
shelly3160
 
unit-1-basics-of-computer-graphics.ppt 7th sem
unit-1-basics-of-computer-graphics.ppt 7th semunit-1-basics-of-computer-graphics.ppt 7th sem
unit-1-basics-of-computer-graphics.ppt 7th sem
PankajPakhare1
 
GJU MM Unit 3.pdf
GJU MM Unit 3.pdfGJU MM Unit 3.pdf
GJU MM Unit 3.pdf
diljots78
 
Chapter 3 : IMAGE
Chapter 3 : IMAGEChapter 3 : IMAGE
Chapter 3 : IMAGE
azira96
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
nooramirahazmn
 
Overview of graphics systems.ppt
Overview of graphics systems.pptOverview of graphics systems.ppt
Overview of graphics systems.ppt
MalleshBettadapura1
 
Chapter Six
Chapter SixChapter Six
Chapter Six
Nada G.Youssef
 
Game development terminologies
Game development terminologiesGame development terminologies
Game development terminologies
Ahmed Badr
 
06 cie552 image_manipulation
06 cie552 image_manipulation06 cie552 image_manipulation
06 cie552 image_manipulation
Elsayed Hemayed
 
CS101- Introduction to Computing- Lecture 34
CS101- Introduction to Computing- Lecture 34CS101- Introduction to Computing- Lecture 34
CS101- Introduction to Computing- Lecture 34
Bilal Ahmed
 
chapter images multimedia subject to make.ppt
chapter images multimedia subject to make.pptchapter images multimedia subject to make.ppt
chapter images multimedia subject to make.ppt
StephenCajelo1
 
Les 2 game 3d - texturing & materials
Les 2   game 3d - texturing & materialsLes 2   game 3d - texturing & materials
Les 2 game 3d - texturing & materials
Francisco Peters
 
Convolutional neural network in deep learning
Convolutional neural network in deep learningConvolutional neural network in deep learning
Convolutional neural network in deep learning
priyasjcettnj
 
Convolutional neural network in deep learning
Convolutional neural network in deep learningConvolutional neural network in deep learning
Convolutional neural network in deep learning
priyasjcettnj
 
Image & Graphics
Image & GraphicsImage & Graphics
Image & Graphics
Shafiqul Islam Tuhin
 
MM3.ppt
MM3.pptMM3.ppt
MM3.ppt
yasharbanihashem
 
basics-of-computer-graphics-ppt.pdf
basics-of-computer-graphics-ppt.pdfbasics-of-computer-graphics-ppt.pdf
basics-of-computer-graphics-ppt.pdf
HarshitTyagi91
 
Overview of graphics systems
Overview of  graphics systemsOverview of  graphics systems
Overview of graphics systems
Jay Nagar
 
CS101- Introduction to Computing- Lecture 33
CS101- Introduction to Computing- Lecture 33CS101- Introduction to Computing- Lecture 33
CS101- Introduction to Computing- Lecture 33
Bilal Ahmed
 
Ciencias de la computación, Gráficos por computadora.
Ciencias de la computación, Gráficos por computadora.Ciencias de la computación, Gráficos por computadora.
Ciencias de la computación, Gráficos por computadora.
Watchsoft
 
Chapter 6 Graphics
Chapter 6 GraphicsChapter 6 Graphics
Chapter 6 Graphics
shelly3160
 
unit-1-basics-of-computer-graphics.ppt 7th sem
unit-1-basics-of-computer-graphics.ppt 7th semunit-1-basics-of-computer-graphics.ppt 7th sem
unit-1-basics-of-computer-graphics.ppt 7th sem
PankajPakhare1
 
GJU MM Unit 3.pdf
GJU MM Unit 3.pdfGJU MM Unit 3.pdf
GJU MM Unit 3.pdf
diljots78
 
Chapter 3 : IMAGE
Chapter 3 : IMAGEChapter 3 : IMAGE
Chapter 3 : IMAGE
azira96
 
Overview of graphics systems.ppt
Overview of graphics systems.pptOverview of graphics systems.ppt
Overview of graphics systems.ppt
MalleshBettadapura1
 
Game development terminologies
Game development terminologiesGame development terminologies
Game development terminologies
Ahmed Badr
 
06 cie552 image_manipulation
06 cie552 image_manipulation06 cie552 image_manipulation
06 cie552 image_manipulation
Elsayed Hemayed
 
CS101- Introduction to Computing- Lecture 34
CS101- Introduction to Computing- Lecture 34CS101- Introduction to Computing- Lecture 34
CS101- Introduction to Computing- Lecture 34
Bilal Ahmed
 
chapter images multimedia subject to make.ppt
chapter images multimedia subject to make.pptchapter images multimedia subject to make.ppt
chapter images multimedia subject to make.ppt
StephenCajelo1
 
Les 2 game 3d - texturing & materials
Les 2   game 3d - texturing & materialsLes 2   game 3d - texturing & materials
Les 2 game 3d - texturing & materials
Francisco Peters
 
Convolutional neural network in deep learning
Convolutional neural network in deep learningConvolutional neural network in deep learning
Convolutional neural network in deep learning
priyasjcettnj
 
Convolutional neural network in deep learning
Convolutional neural network in deep learningConvolutional neural network in deep learning
Convolutional neural network in deep learning
priyasjcettnj
 
basics-of-computer-graphics-ppt.pdf
basics-of-computer-graphics-ppt.pdfbasics-of-computer-graphics-ppt.pdf
basics-of-computer-graphics-ppt.pdf
HarshitTyagi91
 
Overview of graphics systems
Overview of  graphics systemsOverview of  graphics systems
Overview of graphics systems
Jay Nagar
 
Ad

More from Gaditek (20)

Digital marketing strategy and planning | About Business
Digital marketing strategy and planning | About BusinessDigital marketing strategy and planning | About Business
Digital marketing strategy and planning | About Business
Gaditek
 
Intro to social network analysis | What is Network Analysis? | History of (So...
Intro to social network analysis | What is Network Analysis? | History of (So...Intro to social network analysis | What is Network Analysis? | History of (So...
Intro to social network analysis | What is Network Analysis? | History of (So...
Gaditek
 
Marketing ethics and social responsibility | Criticisms of Marketing
Marketing ethics and social responsibility | Criticisms of MarketingMarketing ethics and social responsibility | Criticisms of Marketing
Marketing ethics and social responsibility | Criticisms of Marketing
Gaditek
 
understanding and capturing customer value | What Is a Price?
understanding and capturing customer value | What Is a Price?understanding and capturing customer value | What Is a Price?
understanding and capturing customer value | What Is a Price?
Gaditek
 
The marketing environment | Suppliers | Marketing intermediaries
The marketing environment | Suppliers | Marketing intermediariesThe marketing environment | Suppliers | Marketing intermediaries
The marketing environment | Suppliers | Marketing intermediaries
Gaditek
 
strategic planning | Customer Relationships | Partnering to Build
strategic planning | Customer Relationships | Partnering to Build strategic planning | Customer Relationships | Partnering to Build
strategic planning | Customer Relationships | Partnering to Build
Gaditek
 
Digital marketing | what is marketing?
Digital marketing | what is marketing?Digital marketing | what is marketing?
Digital marketing | what is marketing?
Gaditek
 
Fundamentals of Computer Design including performance measurements & quantita...
Fundamentals of Computer Design including performance measurements & quantita...Fundamentals of Computer Design including performance measurements & quantita...
Fundamentals of Computer Design including performance measurements & quantita...
Gaditek
 
Dealing with exceptions Computer Architecture part 2
Dealing with exceptions Computer Architecture part 2Dealing with exceptions Computer Architecture part 2
Dealing with exceptions Computer Architecture part 2
Gaditek
 
Dealing with Exceptions Computer Architecture part 1
Dealing with Exceptions Computer Architecture part 1Dealing with Exceptions Computer Architecture part 1
Dealing with Exceptions Computer Architecture part 1
Gaditek
 
Pipelining of Processors
Pipelining of ProcessorsPipelining of Processors
Pipelining of Processors
Gaditek
 
Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)
Gaditek
 
differential equation Lecture#14
differential equation  Lecture#14differential equation  Lecture#14
differential equation Lecture#14
Gaditek
 
differential equation Lecture#12
differential equation Lecture#12differential equation Lecture#12
differential equation Lecture#12
Gaditek
 
differential equation Lecture#11
differential equation Lecture#11differential equation Lecture#11
differential equation Lecture#11
Gaditek
 
differential equation Lecture#13
differential equation Lecture#13differential equation Lecture#13
differential equation Lecture#13
Gaditek
 
differential equation Lecture#10
differential equation Lecture#10differential equation Lecture#10
differential equation Lecture#10
Gaditek
 
differential equation Lecture#9
differential equation  Lecture#9differential equation  Lecture#9
differential equation Lecture#9
Gaditek
 
differential equation Lecture#8
differential equation Lecture#8differential equation Lecture#8
differential equation Lecture#8
Gaditek
 
differential equation Lecture#7
differential equation Lecture#7differential equation Lecture#7
differential equation Lecture#7
Gaditek
 
Digital marketing strategy and planning | About Business
Digital marketing strategy and planning | About BusinessDigital marketing strategy and planning | About Business
Digital marketing strategy and planning | About Business
Gaditek
 
Intro to social network analysis | What is Network Analysis? | History of (So...
Intro to social network analysis | What is Network Analysis? | History of (So...Intro to social network analysis | What is Network Analysis? | History of (So...
Intro to social network analysis | What is Network Analysis? | History of (So...
Gaditek
 
Marketing ethics and social responsibility | Criticisms of Marketing
Marketing ethics and social responsibility | Criticisms of MarketingMarketing ethics and social responsibility | Criticisms of Marketing
Marketing ethics and social responsibility | Criticisms of Marketing
Gaditek
 
understanding and capturing customer value | What Is a Price?
understanding and capturing customer value | What Is a Price?understanding and capturing customer value | What Is a Price?
understanding and capturing customer value | What Is a Price?
Gaditek
 
The marketing environment | Suppliers | Marketing intermediaries
The marketing environment | Suppliers | Marketing intermediariesThe marketing environment | Suppliers | Marketing intermediaries
The marketing environment | Suppliers | Marketing intermediaries
Gaditek
 
strategic planning | Customer Relationships | Partnering to Build
strategic planning | Customer Relationships | Partnering to Build strategic planning | Customer Relationships | Partnering to Build
strategic planning | Customer Relationships | Partnering to Build
Gaditek
 
Digital marketing | what is marketing?
Digital marketing | what is marketing?Digital marketing | what is marketing?
Digital marketing | what is marketing?
Gaditek
 
Fundamentals of Computer Design including performance measurements & quantita...
Fundamentals of Computer Design including performance measurements & quantita...Fundamentals of Computer Design including performance measurements & quantita...
Fundamentals of Computer Design including performance measurements & quantita...
Gaditek
 
Dealing with exceptions Computer Architecture part 2
Dealing with exceptions Computer Architecture part 2Dealing with exceptions Computer Architecture part 2
Dealing with exceptions Computer Architecture part 2
Gaditek
 
Dealing with Exceptions Computer Architecture part 1
Dealing with Exceptions Computer Architecture part 1Dealing with Exceptions Computer Architecture part 1
Dealing with Exceptions Computer Architecture part 1
Gaditek
 
Pipelining of Processors
Pipelining of ProcessorsPipelining of Processors
Pipelining of Processors
Gaditek
 
Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)
Gaditek
 
differential equation Lecture#14
differential equation  Lecture#14differential equation  Lecture#14
differential equation Lecture#14
Gaditek
 
differential equation Lecture#12
differential equation Lecture#12differential equation Lecture#12
differential equation Lecture#12
Gaditek
 
differential equation Lecture#11
differential equation Lecture#11differential equation Lecture#11
differential equation Lecture#11
Gaditek
 
differential equation Lecture#13
differential equation Lecture#13differential equation Lecture#13
differential equation Lecture#13
Gaditek
 
differential equation Lecture#10
differential equation Lecture#10differential equation Lecture#10
differential equation Lecture#10
Gaditek
 
differential equation Lecture#9
differential equation  Lecture#9differential equation  Lecture#9
differential equation Lecture#9
Gaditek
 
differential equation Lecture#8
differential equation Lecture#8differential equation Lecture#8
differential equation Lecture#8
Gaditek
 
differential equation Lecture#7
differential equation Lecture#7differential equation Lecture#7
differential equation Lecture#7
Gaditek
 
Ad

Recently uploaded (20)

Ajanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of HistoryAjanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of History
Virag Sontakke
 
Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)
Mohamed Rizk Khodair
 
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon DolabaniHistory Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
fruinkamel7m
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
Pope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptxPope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptx
Martin M Flynn
 
E-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26ASE-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26AS
Abinash Palangdar
 
spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)
Mohamed Rizk Khodair
 
How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18
Celine George
 
Overview Well-Being and Creative Careers
Overview Well-Being and Creative CareersOverview Well-Being and Creative Careers
Overview Well-Being and Creative Careers
University of Amsterdam
 
Cultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptxCultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptx
UmeshTimilsina1
 
What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)
jemille6
 
Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...
parmarjuli1412
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM & Mia eStudios
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
*"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"**"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"*
Arshad Shaikh
 
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Association for Project Management
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptxANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
Mayuri Chavan
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
Nguyen Thanh Tu Collection
 
Ajanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of HistoryAjanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of History
Virag Sontakke
 
Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)
Mohamed Rizk Khodair
 
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon DolabaniHistory Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
fruinkamel7m
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
Pope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptxPope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptx
Martin M Flynn
 
E-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26ASE-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26AS
Abinash Palangdar
 
spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)
Mohamed Rizk Khodair
 
How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18
Celine George
 
Overview Well-Being and Creative Careers
Overview Well-Being and Creative CareersOverview Well-Being and Creative Careers
Overview Well-Being and Creative Careers
University of Amsterdam
 
Cultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptxCultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptx
UmeshTimilsina1
 
What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)
jemille6
 
Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...
parmarjuli1412
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM & Mia eStudios
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
*"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"**"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"*
Arshad Shaikh
 
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Association for Project Management
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptxANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
Mayuri Chavan
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
Nguyen Thanh Tu Collection
 

Graphical Programming

  • 1. Lecture 9 Graphical Programming Lecturer: Sumaira Hussain S.M.I University
  • 2. COMPUTER GRAPHICS • Images created with the help of computers • 2-D and 3-D (displayed on a 2-D screen but in such a way that they give an illusion of depth) • Used for scientific research, artistic expression, or for industrial applications • Graphics have made the computer interfaces more intuitive by removing the need to memorize commands
  • 5. DISPLAYING IMAGES • Most all computer displays consist of a grid of tiny pixels arranged in a regular grid of rows and columns • Images are displayed by assigning different colors to the pixels located in the desired portion of the computer display
  • 6. PIXEL • The smallest image forming element on a computer display • The computer display is made up of a regular grid of these pixels • The computer has the capability of assigning any color to any of the individual pixels on the display • Let’s now see how the computer displays a square
  • 8. PIXEL COLORS (1) • The color of each pixel is generally represented in the form a triplet • In a popular scheme – the RGB scheme – each part of the triplet represents the intensity of one of out of three primary colors: red, green, blue • Often, the intensity of each color is represented with a byte, resulting in 256x256x256 (16+ million) unique color combinations
  • 9. PIXEL COLORS (2) • If this scheme is used to display an image that is equal to the size of an XGA (1024x768 pixels) display, the image will require 2.25MB of storage, which is just too much • A number of clever schemes have been invented to reduce the number of bytes that are required for storing graphics. 2 popular ones: – Color mapping – Dithering
  • 10. COLOR MAPPING (1) • Instead of letting each pixel assume one out of 16 million possible colors, only a limited number of colors – called the platelet – are allowed • For example, the platelet may be restricted to 256 colors (requiring 1 byte/pixel instead of 3)
  • 11. COLOR MAPPING (2) • Each value, from 0 to 255, is mapped to a selected RGB color through a table, reducing the size of a 2.25MB graphic to 0.75MB • The quality of the displayed image will not suffer at all if the image only uses colors that are a part of the platelet
  • 12. COLOR PLATELET EXAMPLE Color Platelet Code Actual Color in RGB 1 255, 255, 000 (yellow) 2 255, 000, 000 (red) 3 000, 255, 255 (cyan) 4 255, 153, 051 (orange) … … … … … …
  • 13. DITHERING • In this scheme, pixels of alternating colors are used to simulate a color that is not present in the platelet • For example, red and green pixels can be alternated to give the impression of bright yellow • The quality of the displayed image is poorer
  • 14. ALIASING • The computer screen consists of square-ish pixels arranged in a fixed grid • At times, when a diagonal line is drawn on this grid, it looks more like a staircase, instead of a straight line • This effect – called aliasing – can be managed by reducing the size of pixels
  • 16. ANTI-ALIASING (1) • Anti-aliasing is another technique used for managing the ‘staircase’ effect • Let’s say that we need to draw a white straight-line such that it overlaps 60% with one pixel, and 40% with another initially, and near the end, 58%, 41%, and 1%, respectively, with three pixels
  • 17. ANTI-ALIASING (2) • The staircase effect is caused because the proper drawing of the line requires a pixel that does not exist • There are three options in this case: – Assign the white color to the pixel corresponding to the largest overlap – Assign the white color to both pixels • Either of these will cause the staircase effect
  • 20. ANTI-ALIASING (3) • The 3rd option is to color the pixel with 60% overlap to a 40% gray color & the other one to 60% gray • Result: A smoother - pleasing to the eye - look
  • 22. GRAPHICS FILE FORMATS The choice of the format generally depends upon the nature of the image. For example: – An image of natural scenery contains many irregular, non-geometric shapes, therefore is stored in bit-map format – A CAD drawing consists of many geometric shapes like straight lines, arcs, etc. and therefore is stored in a vector format – A third situation arises when dealing with graphics that contain both regular and irregular shapes
  • 23. VECTOR OR OBJECT-ORIENTED GRAPHICS • Treats everything that is drawn as an object • Objects retain their identity after they are drawn • These objects can later be easily moved, stretched, duplicated, deleted, etc • Are resolution independent • Relatively small file size • Examples: swf, svg, wmf, ps
  • 24. BIT-MAPPED OR RASTER GRAPHICS • Treats everything that is drawn as a bit-map • If an object is drawn on top of another, it is difficult to move just one of them while leaving the other untouched • Changing the resolution often requires considerable touch-up work • Relatively large file size • Examples: gif, jpg, bmp
  • 25. FILE FORMATS POPULAR ON THE WEB (1) gif (Graphical Interchange Format) –Bit-map images compressed using the LZW algo. –The number of colors is first reduced to 256 and then consecutive pixels having the same color are encoded in a [color, numberOfPixels] format –Works well with computer-generated graphics (e.g. CAD, block diagrams, cartoons) but not with natural, realistic images –Loss-less for images having 256 colors or less
  • 26. FILE FORMATS POPULAR ON THE WEB (2) jpg (JPEG – Joint Photographic Experts Group) –Compressed, full-color and gray-scale bit-map images of natural, real-world scenes, where most every pixel differs in color from its neighbor –It does not work as well as gif with non-realistic images, such as cartoons or line drawings –Does not handle compression of B&W images –Lossy
  • 27. FILE FORMATS POPULAR ON THE WEB (3) swf (Shockwave Flash) – Designed for 2-D animations, but can also be used for storing static vector images as well – A special program (called a plug-in) is required to view swf files in a Web browser svg (Structured Vector Graphics) – New format; may become more popular than swf – Scalable Vector Graphics (SVG) is an XML-based vector image format for two-dimensional graphics with support for interactivity and animation. The SVG specification is an open standard developed by the World Wide Web Consortium (W3C) since 1999. SVG images and their behaviors are defined in XML text files.
  • 28. IMAGE PROCESSING • A branch of computer science concerned with manipulating and enhancing computer graphics • Examples: – Converting 2-D satellite imagery into a 3-D model of a terrain – Restoring old, faded photographs into something closer to the original – Determining the amount of silting in Tarbela lake from a satellite image
  • 29. 3-D GRAPHICS (1) • Flat images enhanced to impart the illusion of depth • We perceive the world and the objects in it in 3-D - breadth, width, depth - although the images formed on the retinas of our eyes are 2-D • The secret of 3-D perception: stereo vision (Computer stereo vision is the extraction of 3D information from digital images, such as obtained by a CCD camera.)
  • 30. 3-D GRAPHICS (2) • The two eyes are spaced a few cm apart • Result: The images formed on the two retinas are slightly different • The brain combines these two into a single 3-D image, enabling us to perceive depth
  • 31. 3-D GRAPHICS: APPLICATIONS • Games • Medical images • 3-D CAD
  • 32. 3-D RENDERING • The process of converting information about 3-D objects into a bit-map that can be displayed on a 2- D computer display • Computationally, very expensive! • Steps: – Draw the wire-frame (skeleton, made with thin lines) – Fill with colors, textures, patterns – Add lighting effects (reflections, shadows)
  • 33. ANIMATION • Graphics in motion, e.g. cartoons • Illusion of motion is created by showing the viewer a sequence of still images, rapidly • Drawing those images - each slightly different from the previous one - used to be quite tedious work • Computers have helped in cutting down some of the tediousness
  • 36. COMPUTER ANIMATION: EXAMPLES • Games • Cartoons, movies • Visualization of processes, e.g the IM process • Displaying the results of scientific experiments, e.g. nuclear fusion
  • 37. TWEENING (1) • Creating a reasonable illusion of motion requires the drawing of 14-30 images per second of animation – very tedious! • In practice, only 4-5 images (called key images) instead of 14-30 are drawn, and then the computer is asked to create the remaining in-between images
  • 38. TWEENING (2) • This process of creating these in-between images from key images is called in-betweening (or tweening for short) • The simplest algorithm for tweening calculates the position of a particular segment of an image by calculating the average of the positions of that same image segment belonging to adjacent key images
  • 39. THE FUTURE OF GRAPHICS & ANIMATION • New graphic-file storage formats will appear with better compression efficiencies • 3-D animation will become more popular as computers become faster and algorithms become smarter • More realistic games; better realism in movies – may, one day, make the human actors extinct
  翻译: