SlideShare una empresa de Scribd logo
1 de 16
Graphics 1
Graphics & Graphical
Programming
Lecture 2 - Graphics Fundamentals
Graphics 2
Fundamentals Outline
• Historical perspective
• Model of a Computer - Memory & Graphics
• Devices
• Raster Model & Bitmaps
• Coordinates
• Drawing Spaces
• Colours
• Graphics Libraries
Graphics 3
Brief History
• Teletypes(pre 1950s), Display Tubes(post
WW2), CRTs(last half of 20th century), Flat
Panels (modern era)
• Size and Quality (eg resolution) driven by
economics (eg 640x320…1024x768…)
• Vector (circa WW2) & Raster/Bitmap models
• Devices & Human / Machine Interaction
• Memory and Processing Speed limitations
Graphics 4
Computer Memory Model
• Main Memory
• Graphics memory
– Used to be limited to separate
amount on eg graphics card
– Modern idea is to partition
main memory dynamically
(ie by software instruction)
• Modern idea is to map
memory to the display
• Independent of display
hardware type
• CPU + Cache memory +
Main memory
• Cache memory is fast but
expensive so (still often)
only have small amount eg
512kBytes available
• Main memory relatively
plentiful (eg GBytes) but
slow
Graphics 5
Memory & Graphics
• Idea is that we can write
programs that interact
with the graphical
display device simply
by writing to a
predetermined area of the
computer’s memory
• Known as Bitmap graphics
• The bits are mapped to the
pixels
• Flexible, portable software
• Independent of Hardware &
Operating System
Graphics 6
Graphical Devices
• Devices eg mouse,
stereo glasses, tracker
ball, light pen, touch
screen, 3d-wand, “rat”,
sensor gloves, head
tracker, iris tracker,…
• Even Mouse varies in
form factor and number
of buttons
• Mouse - most well known
device
• Buttons, and scan movements
• Jargon ideas that have become
common:
– Drag
– Click
– Double-Click
– Left -Click
• Main idea is to let you specify a
location in a space eg x,y (or
x,y,z) coordinates
Graphics 7
Raster Model - Pixels
• Pixel or sometimes “pel”
Picture Element
• Each pixel is a sample
that can be rendered as a
dot or rectangle on the
screen
• Often try to design them
as squares but not always
• Might be implemented
as small area of
phosphor on a
monochrome monitor
• Or three areas of eg
red, green and blue
phosphors for colour
• Or simple a transistor
logic gate assembly
on a flat panel display
Graphics 8
Coordinate Systems
• Pixel Coordinate System -
rows and columns
• Rectilinear
• Usually for graphics, we
start at top left corner and
work our way across and
down
• Same as raster orientation
• Array[row][column]
• Row major used in C
and C+ ( last index
moves fastest in
memory)
• Not all languages do
it this way - eg Fortran
uses column major
(first index moves
fastest)
Graphics 9
Cartesian Coordinates
• Often we use the
Cartesian coordinate
convention ie x,y
coordinates (or x,y,z
in 3D) and map this
to our display
• Usually column
corresponds to x, and
-row corresponds to y
• This works if we know
the max min values.
• Common values are eg
640 columns x 320 rows
• Or 1024x768 or better
• Aspect ratio is the ratio of
these eg 4:3 - Chosen to suit
the common display devices
eg TV screens or monitors
x
y
Graphics 10
Drawing Space or Canvas
• Coordinate Systems
• Drawing Primitives
• Library of utilities
– eg drawDot( int x, int y);
– Or drawLine( x1, y1, x2, y2 );
• Usually we have “Primitive”
Models for coordinate spaces
and colours
• We do not want to write
our application programs
worrying about pixel
resolutions
• We may have libraries
that allow us to do so, but
often they will support
more general coordinates
• Eg real space
“normalised” coordinates
[0.0,1.0]
Graphics 11
Colours in Brief
• Red Green Blue is not the
Only colour model although
still most common
• We specify separate RGB
values for each pixel
• They map to intensities
• All colours can be expressed
as combination of these
• Sometimes also an “alpha” or
transparency value
• These will conveniently pack
into a computer word of 4
bytes, one byte for each
entity
• 1 Byte gives us 256 values
- hence numbers of colours
• Need not use this resolution
• Can also use Look-up tables
to save memory
Graphics 12
Graphics Libraries and packages
• What is a graphics
system?
• A package or Library
that links to a Language
or environment and lets
us write programs that
are independent of the
graphics hardware and
devices
• Java Development Kit
and Java 2D and Java
3D libraries
• GL and OpenGL
(Graphics Library),
VOGL
• X11, DirectX, PHIGS,…
and lots of others
Graphics 13
Java Graphics Program Outline
• A short example- MyProg01 draws a black
rectangle inside a white rectangle
• See the course web pages for these codes
• Use a text editor or your favourite text tool
(eg emacs or vi or notepad) to create
MyProg01.java
• Compile it using javac MyProg01.java
• Run using java Myprog01
Graphics 14
Java Graphics Code Fragment
// g2 is the Graphics2D object supplied by the system…
g2.setBackground( Color.white ); // set background colour
g2.clearRect( 0, 0, getWidth(), getHeight() ); // clear an area
g2.setColor( Color.black ); // set the drawing colour
g2.fillRect( 10, 10, 20, 20 ); // fill in a rectangle of that colour
g2.drawRect( 0, 0, getWidth()-1, getHeight()-1 ); // draw a border around everything
• More on how this works next lecture and at
the tutorials…
Graphics 15
What MyProg01 Output Looks Like
Black rectangle inside a white area…
Graphics 16
Summary
• Graphics has a varied
history
• Very technology driven
• Good advances in recent
years with adequate
memory and processing
power
• Primitives and library
layers approach is very
common
• Note devices and
memory model
• Colour models and
drawing spaces are
important ideas for our
programs
• We will use the Java
Development Kit graphics
libraries and primitives

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

1. Introduction of Computer Graphics
1. Introduction of Computer Graphics1. Introduction of Computer Graphics
1. Introduction of Computer Graphics
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
 
Computer graphics.
Computer graphics.Computer graphics.
Computer graphics.
 
Lecture applications of cg
Lecture   applications of cgLecture   applications of cg
Lecture applications of cg
 
Introduction Computer Graphic
Introduction Computer GraphicIntroduction Computer Graphic
Introduction Computer Graphic
 
Frame buffer
Frame bufferFrame buffer
Frame buffer
 
Introduction to computer graphics
Introduction to computer graphicsIntroduction to computer graphics
Introduction to computer graphics
 
Introduction to computer graphics
Introduction to computer graphics Introduction to computer graphics
Introduction to computer graphics
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Introduction to computer graphics
Introduction to computer graphicsIntroduction to computer graphics
Introduction to computer graphics
 
Monitors & workstation,Donald ch-2
Monitors & workstation,Donald ch-2Monitors & workstation,Donald ch-2
Monitors & workstation,Donald ch-2
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
 
Introduction to computer graphics
Introduction to computer graphicsIntroduction to computer graphics
Introduction to computer graphics
 
Applications of cg
Applications of cgApplications of cg
Applications of cg
 
Applications Of Computer Graphics
Applications Of Computer GraphicsApplications Of Computer Graphics
Applications Of Computer Graphics
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
 
Applications of computer graphics
Applications of computer graphicsApplications of computer graphics
Applications of computer graphics
 
Unit-1 basics of computer graphics
Unit-1 basics of computer graphicsUnit-1 basics of computer graphics
Unit-1 basics of computer graphics
 
computer graphics
computer graphicscomputer graphics
computer graphics
 

Similar a Graphics Fundamentals: Raster Model, Coordinates, Libraries

CS101- Introduction to Computing- Lecture 33
CS101- Introduction to Computing- Lecture 33CS101- Introduction to Computing- Lecture 33
CS101- Introduction to Computing- Lecture 33Bilal Ahmed
 
Overview of graphics systems.ppt
Overview of graphics systems.pptOverview of graphics systems.ppt
Overview of graphics systems.pptMalleshBettadapura1
 
CS101- Introduction to Computing- Lecture 34
CS101- Introduction to Computing- Lecture 34CS101- Introduction to Computing- Lecture 34
CS101- Introduction to Computing- Lecture 34Bilal Ahmed
 
Gpu with cuda architecture
Gpu with cuda architectureGpu with cuda architecture
Gpu with cuda architectureDhaval Kaneria
 
Graphics Primitives and CG Display Devices
Graphics Primitives and CG Display DevicesGraphics Primitives and CG Display Devices
Graphics Primitives and CG Display DevicesDIPIKA83
 
Sony Computer Entertainment Europe Research & Development Division
Sony Computer Entertainment Europe Research & Development DivisionSony Computer Entertainment Europe Research & Development Division
Sony Computer Entertainment Europe Research & Development DivisionSlide_N
 
Introduction to computer
Introduction to computerIntroduction to computer
Introduction to computerlina hajjar
 
Visualization of Large Multivariate Data Sets using Parallel Coordinates
Visualization of Large Multivariate Data Sets using Parallel CoordinatesVisualization of Large Multivariate Data Sets using Parallel Coordinates
Visualization of Large Multivariate Data Sets using Parallel Coordinateskvaderlipa
 
Large-scale Recommendation Systems on Just a PC
Large-scale Recommendation Systems on Just a PCLarge-scale Recommendation Systems on Just a PC
Large-scale Recommendation Systems on Just a PCAapo Kyrölä
 
Decima Engine: Visibility in Horizon Zero Dawn
Decima Engine: Visibility in Horizon Zero DawnDecima Engine: Visibility in Horizon Zero Dawn
Decima Engine: Visibility in Horizon Zero DawnGuerrilla
 
Данило Ульянич “C89 OpenGL for ARM microcontrollers on Cortex-M. Basic functi...
Данило Ульянич “C89 OpenGL for ARM microcontrollers on Cortex-M. Basic functi...Данило Ульянич “C89 OpenGL for ARM microcontrollers on Cortex-M. Basic functi...
Данило Ульянич “C89 OpenGL for ARM microcontrollers on Cortex-M. Basic functi...Lviv Startup Club
 
GraphChi big graph processing
GraphChi big graph processingGraphChi big graph processing
GraphChi big graph processinghuguk
 
Graphical Programming
Graphical ProgrammingGraphical Programming
Graphical ProgrammingGaditek
 

Similar a Graphics Fundamentals: Raster Model, Coordinates, Libraries (20)

CS101- Introduction to Computing- Lecture 33
CS101- Introduction to Computing- Lecture 33CS101- Introduction to Computing- Lecture 33
CS101- Introduction to Computing- Lecture 33
 
Overview of graphics systems.ppt
Overview of graphics systems.pptOverview of graphics systems.ppt
Overview of graphics systems.ppt
 
UNit4.pdf
UNit4.pdfUNit4.pdf
UNit4.pdf
 
What is OpenGL ?
What is OpenGL ?What is OpenGL ?
What is OpenGL ?
 
CS101- Introduction to Computing- Lecture 34
CS101- Introduction to Computing- Lecture 34CS101- Introduction to Computing- Lecture 34
CS101- Introduction to Computing- Lecture 34
 
Disco workshop
Disco workshopDisco workshop
Disco workshop
 
Unit 11. Graphics
Unit 11. GraphicsUnit 11. Graphics
Unit 11. Graphics
 
Gpu with cuda architecture
Gpu with cuda architectureGpu with cuda architecture
Gpu with cuda architecture
 
Graphics Primitives and CG Display Devices
Graphics Primitives and CG Display DevicesGraphics Primitives and CG Display Devices
Graphics Primitives and CG Display Devices
 
Sony Computer Entertainment Europe Research & Development Division
Sony Computer Entertainment Europe Research & Development DivisionSony Computer Entertainment Europe Research & Development Division
Sony Computer Entertainment Europe Research & Development Division
 
Mod 2 hardware_graphics.pdf
Mod 2 hardware_graphics.pdfMod 2 hardware_graphics.pdf
Mod 2 hardware_graphics.pdf
 
Buffers
BuffersBuffers
Buffers
 
Introduction to computer
Introduction to computerIntroduction to computer
Introduction to computer
 
Visualization of Large Multivariate Data Sets using Parallel Coordinates
Visualization of Large Multivariate Data Sets using Parallel CoordinatesVisualization of Large Multivariate Data Sets using Parallel Coordinates
Visualization of Large Multivariate Data Sets using Parallel Coordinates
 
Large-scale Recommendation Systems on Just a PC
Large-scale Recommendation Systems on Just a PCLarge-scale Recommendation Systems on Just a PC
Large-scale Recommendation Systems on Just a PC
 
Parallel Rendering
Parallel RenderingParallel Rendering
Parallel Rendering
 
Decima Engine: Visibility in Horizon Zero Dawn
Decima Engine: Visibility in Horizon Zero DawnDecima Engine: Visibility in Horizon Zero Dawn
Decima Engine: Visibility in Horizon Zero Dawn
 
Данило Ульянич “C89 OpenGL for ARM microcontrollers on Cortex-M. Basic functi...
Данило Ульянич “C89 OpenGL for ARM microcontrollers on Cortex-M. Basic functi...Данило Ульянич “C89 OpenGL for ARM microcontrollers on Cortex-M. Basic functi...
Данило Ульянич “C89 OpenGL for ARM microcontrollers on Cortex-M. Basic functi...
 
GraphChi big graph processing
GraphChi big graph processingGraphChi big graph processing
GraphChi big graph processing
 
Graphical Programming
Graphical ProgrammingGraphical Programming
Graphical Programming
 

Más de Daroko blog(www.professionalbloggertricks.com)

Más de Daroko blog(www.professionalbloggertricks.com) (20)

Small Business ideas you can start in Nigeria 2014(best Business ideas Nigeri...
Small Business ideas you can start in Nigeria 2014(best Business ideas Nigeri...Small Business ideas you can start in Nigeria 2014(best Business ideas Nigeri...
Small Business ideas you can start in Nigeria 2014(best Business ideas Nigeri...
 
Agriculture business ideas for 2014(Business ideas Kenya,Business ideas Niger...
Agriculture business ideas for 2014(Business ideas Kenya,Business ideas Niger...Agriculture business ideas for 2014(Business ideas Kenya,Business ideas Niger...
Agriculture business ideas for 2014(Business ideas Kenya,Business ideas Niger...
 
An Introduction to Project management(project management tutorials)
An Introduction to Project management(project management tutorials)An Introduction to Project management(project management tutorials)
An Introduction to Project management(project management tutorials)
 
java arlow jdbc tutorial(java programming tutorials)
java arlow jdbc tutorial(java programming tutorials)java arlow jdbc tutorial(java programming tutorials)
java arlow jdbc tutorial(java programming tutorials)
 
The java rogramming swing _tutorial for beinners(java programming language)
The java rogramming swing _tutorial for beinners(java programming language)The java rogramming swing _tutorial for beinners(java programming language)
The java rogramming swing _tutorial for beinners(java programming language)
 
Java programming basics notes for beginners(java programming tutorials)
Java programming basics notes for beginners(java programming tutorials)Java programming basics notes for beginners(java programming tutorials)
Java programming basics notes for beginners(java programming tutorials)
 
advanced java programming(java programming tutorials)
 advanced java programming(java programming tutorials) advanced java programming(java programming tutorials)
advanced java programming(java programming tutorials)
 
java swing tutorial for beginners(java programming tutorials)
java swing tutorial for beginners(java programming tutorials)java swing tutorial for beginners(java programming tutorials)
java swing tutorial for beginners(java programming tutorials)
 
An introduction to java programming language forbeginners(java programming tu...
An introduction to java programming language forbeginners(java programming tu...An introduction to java programming language forbeginners(java programming tu...
An introduction to java programming language forbeginners(java programming tu...
 
bresenham circles and polygons in computer graphics(Computer graphics tutorials)
bresenham circles and polygons in computer graphics(Computer graphics tutorials)bresenham circles and polygons in computer graphics(Computer graphics tutorials)
bresenham circles and polygons in computer graphics(Computer graphics tutorials)
 
Computer Graphics display technologies(Computer graphics tutorials and tips)
Computer Graphics display technologies(Computer graphics tutorials and tips)Computer Graphics display technologies(Computer graphics tutorials and tips)
Computer Graphics display technologies(Computer graphics tutorials and tips)
 
Computer Graphics display technologies(Computer graphics tutorials)
Computer Graphics display technologies(Computer graphics tutorials)Computer Graphics display technologies(Computer graphics tutorials)
Computer Graphics display technologies(Computer graphics tutorials)
 
Displays and color system in computer graphics(Computer graphics tutorials)
Displays and color system in computer graphics(Computer graphics tutorials)Displays and color system in computer graphics(Computer graphics tutorials)
Displays and color system in computer graphics(Computer graphics tutorials)
 
Data structures graphics library in computer graphics.
Data structures  graphics library in computer graphics.Data structures  graphics library in computer graphics.
Data structures graphics library in computer graphics.
 
lecture8 clipping
lecture8 clippinglecture8 clipping
lecture8 clipping
 
Csc406 lecture7 device independence and normalization in Computer graphics(Co...
Csc406 lecture7 device independence and normalization in Computer graphics(Co...Csc406 lecture7 device independence and normalization in Computer graphics(Co...
Csc406 lecture7 device independence and normalization in Computer graphics(Co...
 
lecture3 color representation in computer graphics(Computer graphics tutorials)
lecture3 color representation in computer graphics(Computer graphics tutorials)lecture3 color representation in computer graphics(Computer graphics tutorials)
lecture3 color representation in computer graphics(Computer graphics tutorials)
 
lecture2 computer graphics graphics hardware(Computer graphics tutorials)
 lecture2  computer graphics graphics hardware(Computer graphics tutorials) lecture2  computer graphics graphics hardware(Computer graphics tutorials)
lecture2 computer graphics graphics hardware(Computer graphics tutorials)
 
2d/3D transformations in computer graphics(Computer graphics Tutorials)
2d/3D transformations in computer graphics(Computer graphics Tutorials)2d/3D transformations in computer graphics(Computer graphics Tutorials)
2d/3D transformations in computer graphics(Computer graphics Tutorials)
 
Computer graphics defination(An introuction to computer garphics)
Computer graphics defination(An introuction to computer garphics)Computer graphics defination(An introuction to computer garphics)
Computer graphics defination(An introuction to computer garphics)
 

Último

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 

Último (20)

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 

Graphics Fundamentals: Raster Model, Coordinates, Libraries

  • 1. Graphics 1 Graphics & Graphical Programming Lecture 2 - Graphics Fundamentals
  • 2. Graphics 2 Fundamentals Outline • Historical perspective • Model of a Computer - Memory & Graphics • Devices • Raster Model & Bitmaps • Coordinates • Drawing Spaces • Colours • Graphics Libraries
  • 3. Graphics 3 Brief History • Teletypes(pre 1950s), Display Tubes(post WW2), CRTs(last half of 20th century), Flat Panels (modern era) • Size and Quality (eg resolution) driven by economics (eg 640x320…1024x768…) • Vector (circa WW2) & Raster/Bitmap models • Devices & Human / Machine Interaction • Memory and Processing Speed limitations
  • 4. Graphics 4 Computer Memory Model • Main Memory • Graphics memory – Used to be limited to separate amount on eg graphics card – Modern idea is to partition main memory dynamically (ie by software instruction) • Modern idea is to map memory to the display • Independent of display hardware type • CPU + Cache memory + Main memory • Cache memory is fast but expensive so (still often) only have small amount eg 512kBytes available • Main memory relatively plentiful (eg GBytes) but slow
  • 5. Graphics 5 Memory & Graphics • Idea is that we can write programs that interact with the graphical display device simply by writing to a predetermined area of the computer’s memory • Known as Bitmap graphics • The bits are mapped to the pixels • Flexible, portable software • Independent of Hardware & Operating System
  • 6. Graphics 6 Graphical Devices • Devices eg mouse, stereo glasses, tracker ball, light pen, touch screen, 3d-wand, “rat”, sensor gloves, head tracker, iris tracker,… • Even Mouse varies in form factor and number of buttons • Mouse - most well known device • Buttons, and scan movements • Jargon ideas that have become common: – Drag – Click – Double-Click – Left -Click • Main idea is to let you specify a location in a space eg x,y (or x,y,z) coordinates
  • 7. Graphics 7 Raster Model - Pixels • Pixel or sometimes “pel” Picture Element • Each pixel is a sample that can be rendered as a dot or rectangle on the screen • Often try to design them as squares but not always • Might be implemented as small area of phosphor on a monochrome monitor • Or three areas of eg red, green and blue phosphors for colour • Or simple a transistor logic gate assembly on a flat panel display
  • 8. Graphics 8 Coordinate Systems • Pixel Coordinate System - rows and columns • Rectilinear • Usually for graphics, we start at top left corner and work our way across and down • Same as raster orientation • Array[row][column] • Row major used in C and C+ ( last index moves fastest in memory) • Not all languages do it this way - eg Fortran uses column major (first index moves fastest)
  • 9. Graphics 9 Cartesian Coordinates • Often we use the Cartesian coordinate convention ie x,y coordinates (or x,y,z in 3D) and map this to our display • Usually column corresponds to x, and -row corresponds to y • This works if we know the max min values. • Common values are eg 640 columns x 320 rows • Or 1024x768 or better • Aspect ratio is the ratio of these eg 4:3 - Chosen to suit the common display devices eg TV screens or monitors x y
  • 10. Graphics 10 Drawing Space or Canvas • Coordinate Systems • Drawing Primitives • Library of utilities – eg drawDot( int x, int y); – Or drawLine( x1, y1, x2, y2 ); • Usually we have “Primitive” Models for coordinate spaces and colours • We do not want to write our application programs worrying about pixel resolutions • We may have libraries that allow us to do so, but often they will support more general coordinates • Eg real space “normalised” coordinates [0.0,1.0]
  • 11. Graphics 11 Colours in Brief • Red Green Blue is not the Only colour model although still most common • We specify separate RGB values for each pixel • They map to intensities • All colours can be expressed as combination of these • Sometimes also an “alpha” or transparency value • These will conveniently pack into a computer word of 4 bytes, one byte for each entity • 1 Byte gives us 256 values - hence numbers of colours • Need not use this resolution • Can also use Look-up tables to save memory
  • 12. Graphics 12 Graphics Libraries and packages • What is a graphics system? • A package or Library that links to a Language or environment and lets us write programs that are independent of the graphics hardware and devices • Java Development Kit and Java 2D and Java 3D libraries • GL and OpenGL (Graphics Library), VOGL • X11, DirectX, PHIGS,… and lots of others
  • 13. Graphics 13 Java Graphics Program Outline • A short example- MyProg01 draws a black rectangle inside a white rectangle • See the course web pages for these codes • Use a text editor or your favourite text tool (eg emacs or vi or notepad) to create MyProg01.java • Compile it using javac MyProg01.java • Run using java Myprog01
  • 14. Graphics 14 Java Graphics Code Fragment // g2 is the Graphics2D object supplied by the system… g2.setBackground( Color.white ); // set background colour g2.clearRect( 0, 0, getWidth(), getHeight() ); // clear an area g2.setColor( Color.black ); // set the drawing colour g2.fillRect( 10, 10, 20, 20 ); // fill in a rectangle of that colour g2.drawRect( 0, 0, getWidth()-1, getHeight()-1 ); // draw a border around everything • More on how this works next lecture and at the tutorials…
  • 15. Graphics 15 What MyProg01 Output Looks Like Black rectangle inside a white area…
  • 16. Graphics 16 Summary • Graphics has a varied history • Very technology driven • Good advances in recent years with adequate memory and processing power • Primitives and library layers approach is very common • Note devices and memory model • Colour models and drawing spaces are important ideas for our programs • We will use the Java Development Kit graphics libraries and primitives