SlideShare a Scribd company logo
Unit III
SEgments
Prepared By
Rajani Thite
Introduction
• To humans, an image is not just a random collection of pixels; it is a meaningful
arrangement of regions and objects.
• There also exits a variety of images: natural scenes, paintings, etc. Despite the large
variations of these images, humans have no problem to interpret them.
• The image information is stored in Display file.
• Existing structure of display file does not satisfy the requirements of viewing image.
Display image is modified to reflect the sub picture structure. To achieve this display
file is divided into segments.
The Segment table indicates the portion of the display file used to construct the picture
Display File
Segment Table
Display
Segment table
 The segment table is formed by using arrays. An alternative approach is linked list
 In case of arrays, maximum no. of segments that can be included in the segment
table are equal to the length of the arrays. But with linked list there is no such limit on
the maximum no. of segments; as list is dynamic
 In linked List ordering is achieved by simply adjusting the links. In case of arrays we
have to move actual segment information in the process of sorting the segments.
Segment Start Segment Size Scale X Scale Y Color Link
3
4
2
5
Null/
Segment Number
1
2
For ordering the segment
3
 The Disadvantage of linked list is that it requires more storage to hold the links
and that it is costly to locate arbitrary cells.
 In the linked list deleting the cell means changing two links.
Display file Linked List
OP X Y Link
1
2 2 .1 .5 5
3 1 .1 .1 2
4
5 2 .5 .5 9
6
7 2 .1 .5 0
8
9 2 .7 .5 7
10
Start=3
Segment Creation
 We Must give the segment name so that we can identify it.
 For example say that there is segment no. 3, then all following MOVE and
Line commands would belong to segment 3. We could then close segment 3
and open another.
 First thing to create a segment is to check whether some other segment is
open. We can not open two segments at the same time because we would
not know to which segment we should assign the drawing instructions. If
there is segment open, we have an error
 Next we should select valid segment name and check whether there
already exists a segment under this name. If so, we again have an error.
 The first instruction belonging to this segment will be located at the next
free storage area in the display file. The current size of the segment is zero
since we have not actually entered any instructions into it yet.
CREATE_SEGMENT(SEGMENT-NAME)
Argument SEGMENT-NAME
Global NOW-OPEN the name of currently open segment
FREE the index of the next free display-file cell
SEGMENT-START, SEGMENT-SEZE,VISIBILITY
ANGLE, SCALE-X, SCALE-Y, TRANSLATE-X,TRANSLATE-Y
Constant NUMBER-OF-SEGMENTS
BEGIN
IF NOW-OPEN>0 THEN RETURN ERROR ‘SEGMENT STILL OPEN’;
IF SEGMENT-NAME < 1 OR SEGMENT-NAME > NUMBER-OF-SEGMENTS
THEN RETURN ERROR ‘INVALID SEGMENT NAME’;
IF SEGMENT-SIZE[SEGMENT-NAME]>0 THEN
RETURN ERROR ‘SEGMENT ALREADY EXISTS’;
SEGMENT-START[SEGMENT-NAME]<-FREE;
SEGMENT-SIZE[SEGMENT-NAME]<-0;
VISIBILITY[SEGMENT-NAME] <-VISIBILITY[0];
ANGLE[SEGMENT-NAME] <-ANGLE[0];
SCALE-X[SEGMENT-NAME]<-SCALE-X[0];
SCALE-Y[SEGMENT-NAME]<-SCALE-Y[0];
TRANSLATE-X[SEGMENT-NAME]<-TRANSLATE-X[0];
TRANSLATE-Y[SEGMENT-NAME]<-TRANSLATE-Y[0];
NOW-OPEN<-SEGMENT-NAME;
RETURN;
END;
Closing a Segment
• Once the drawing instructions are completed, we should close it.
• NOW-OPEN variable indicates the name of the currently open segment.
• To close a segment it is necessary to change the name of the currently open
segment. It can be achieved by changing the name of currently open
segment as 0.
• We don’t have two unnamed segments around because we shall show only
one of them and the other would just waist storage.
• If there are two unnamed segments in the display file one has to be deleted.
Algorithm to close Segment
Global NOW-OPEN the name of currently open segment
FREE the index of the next free display-file cell
SEGMENT-START, SEGMENT-SIZE start and size of
the segment
BEGIN
IF NOW-OPEN=0 THEN RETURN ERROR ‘NO
SEGMENT IS OPEN’;
DELETE-SEGMENT[0];
SEGMENT-START[0]<-FREE;
SEGMENT-SIZE[0]<-0;
NOW-OPEN<-0;
RETURN;
END;
Deleting A Segment
 When we want to delete a particular segment from the display file then we
must recover the storage space occupied by its instructions and make this
space free for some other segment. To do this we must not destroy and re-
form the entire display file, but we must delete just one segment, while
preserving the rest of the display file.
 Here we have used arrays to store the display file information.
Segment 1
Segment 2
Segment 3
Segment 4
Unused Space
Segment 1
Segment 3
Segment 4
Unused Space
Delete Algorithm
1. Read the name of the segment which is to be deleted.
2. Check whether the segment name is valid; if not display error “Segment
not valid” go to step 8
3. Check whether the segment is open, if yes, display error message “ Can’t
delete open segment” go to step 8.
4. Check whether the size of segment is greater than 0, if no, no processing
is required as segment contains no instructions.
5. Shift the display file elements which follow the segment which is to be
deleted by it’s size.
6. Recover the deleted space by resetting the index of the next free
instruction.
7. Adjust the starting positions of the shifted segments by subtracting the
size of the deleted segment from it.
8. Stop.
Renaming a Segment
• The display processor is continuously reading the display file and showing its
contents
• Suppose we wish to use this device to show an animated character moving on the
display.
• To display a new image in the sequence we have to delete the current segment and
re-create it with the altered character. The problem in this process is that during the
time after the first image is deleted and time before the second image is completely
entered, only a partially completed character is displayed on the screen.
• We avoid this problem by keeping the next image ready in the display file before
deleting the current segment.
• Segment which is to be deleted and segment which is to be replaced with must exist
in display file at the same time.
• We do this by building the new invisible image under some temporary segment
name. When it is completed, we can delete the original image, make the replacement
image visible, and rename the new segment to become the old segment to achieve
apparent motion.
• The idea of maintaining two images, one to show and one to build or alter, is called
double buffering.
Algorithm to Rename Segment
1. Check whether both old and new segment names are valid; if not display error
message “Not valid segment names” and go to step 6.
2. Check whether any of the two segments are open. If open, display error message
“Segment still open” and go to step 6.
3. Check whether the new name we are going to give to the old segment is not
already existing in the display file. If yes, display error message “Segment
already exists” and go to step 6.
4. Copy the old segment table entry into new position.
5. Delete the old segment.
6. Stop.
Visibility
-Each Segment is given a visibility attribute.
-The segment’s visibility is stored in an array as part of the segment
table.
-By checking this array we can determine whether or not the segment
should be displayed.
Segments in Graphics

More Related Content

What's hot

Character generation techniques
Character generation techniquesCharacter generation techniques
Character generation techniques
Mani Kanth
 
Graphics software and standards
Graphics software and standardsGraphics software and standards
Graphics software and standards
Mani Kanth
 
hidden surface elimination using z buffer algorithm
hidden surface elimination using z buffer algorithmhidden surface elimination using z buffer algorithm
hidden surface elimination using z buffer algorithmrajivagarwal23dei
 
Video display devices
Video display devicesVideo display devices
Video display devicesMohd Arif
 
Window to viewport transformation&amp;matrix representation of homogeneous co...
Window to viewport transformation&amp;matrix representation of homogeneous co...Window to viewport transformation&amp;matrix representation of homogeneous co...
Window to viewport transformation&amp;matrix representation of homogeneous co...
Mani Kanth
 
Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)
shalinikarunakaran1
 
Clipping in Computer Graphics
Clipping in Computer GraphicsClipping in Computer Graphics
Clipping in Computer Graphics
Laxman Puri
 
Overview of the graphics system
Overview of the graphics systemOverview of the graphics system
Overview of the graphics system
Kamal Acharya
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.Mohd Arif
 
Computer graphics realism
Computer graphics realismComputer graphics realism
Computer graphics realism
sathya dhineshkumar
 
Computer graphics chapter 4
Computer graphics chapter 4Computer graphics chapter 4
Computer graphics chapter 4
PrathimaBaliga
 
Raster scan system
Raster scan systemRaster scan system
Raster scan systemMohd Arif
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clipping
Arvind Kumar
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clippingMohd Arif
 
Raster scan system & random scan system
Raster scan system & random scan systemRaster scan system & random scan system
Raster scan system & random scan system
shalinikarunakaran1
 
Computer Graphics: Visible surface detection methods
Computer Graphics: Visible surface detection methodsComputer Graphics: Visible surface detection methods
Computer Graphics: Visible surface detection methods
Joseph Charles
 
Circle drawing algo.
Circle drawing algo.Circle drawing algo.
Circle drawing algo.Mohd Arif
 
Anti- aliasing computer graphics
Anti- aliasing computer graphicsAnti- aliasing computer graphics
Anti- aliasing computer graphics
Safayet Hossain
 
Spline representations
Spline representationsSpline representations
Spline representations
Nikhil krishnan
 
Back face detection
Back face detectionBack face detection
Back face detection
Pooja Dixit
 

What's hot (20)

Character generation techniques
Character generation techniquesCharacter generation techniques
Character generation techniques
 
Graphics software and standards
Graphics software and standardsGraphics software and standards
Graphics software and standards
 
hidden surface elimination using z buffer algorithm
hidden surface elimination using z buffer algorithmhidden surface elimination using z buffer algorithm
hidden surface elimination using z buffer algorithm
 
Video display devices
Video display devicesVideo display devices
Video display devices
 
Window to viewport transformation&amp;matrix representation of homogeneous co...
Window to viewport transformation&amp;matrix representation of homogeneous co...Window to viewport transformation&amp;matrix representation of homogeneous co...
Window to viewport transformation&amp;matrix representation of homogeneous co...
 
Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)
 
Clipping in Computer Graphics
Clipping in Computer GraphicsClipping in Computer Graphics
Clipping in Computer Graphics
 
Overview of the graphics system
Overview of the graphics systemOverview of the graphics system
Overview of the graphics system
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.
 
Computer graphics realism
Computer graphics realismComputer graphics realism
Computer graphics realism
 
Computer graphics chapter 4
Computer graphics chapter 4Computer graphics chapter 4
Computer graphics chapter 4
 
Raster scan system
Raster scan systemRaster scan system
Raster scan system
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clipping
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
Raster scan system & random scan system
Raster scan system & random scan systemRaster scan system & random scan system
Raster scan system & random scan system
 
Computer Graphics: Visible surface detection methods
Computer Graphics: Visible surface detection methodsComputer Graphics: Visible surface detection methods
Computer Graphics: Visible surface detection methods
 
Circle drawing algo.
Circle drawing algo.Circle drawing algo.
Circle drawing algo.
 
Anti- aliasing computer graphics
Anti- aliasing computer graphicsAnti- aliasing computer graphics
Anti- aliasing computer graphics
 
Spline representations
Spline representationsSpline representations
Spline representations
 
Back face detection
Back face detectionBack face detection
Back face detection
 

Similar to Segments in Graphics

Segments, illumination models, color models and shading
Segments, illumination models, color models and shadingSegments, illumination models, color models and shading
Segments, illumination models, color models and shading
madhurianwat2
 
CG_U6_M1.pptx
CG_U6_M1.pptxCG_U6_M1.pptx
CG_U6_M1.pptx
MadhuriAnwat
 
Segment Structure Display List in Computer Graphics.pptx
Segment Structure Display List in Computer Graphics.pptxSegment Structure Display List in Computer Graphics.pptx
Segment Structure Display List in Computer Graphics.pptx
JeoJoyA
 
Visi progress
Visi progressVisi progress
Visi progress
Frankey Sun
 
GDE Lab 1 – Traffic Light Pg. 1 Lab 1 Traffic L.docx
GDE Lab 1 – Traffic Light  Pg. 1     Lab 1 Traffic L.docxGDE Lab 1 – Traffic Light  Pg. 1     Lab 1 Traffic L.docx
GDE Lab 1 – Traffic Light Pg. 1 Lab 1 Traffic L.docx
budbarber38650
 
View Tab in Ms-Excel
View Tab in Ms-ExcelView Tab in Ms-Excel
View Tab in Ms-Excel
Chandan Kumar Gupta
 
Goodbye Nightmare : Tops and Tricks for creating Layouts
Goodbye Nightmare : Tops and Tricks for creating LayoutsGoodbye Nightmare : Tops and Tricks for creating Layouts
Goodbye Nightmare : Tops and Tricks for creating Layouts
Luc Bors
 
Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...
Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...
Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...
Getting value from IoT, Integration and Data Analytics
 
cnn ppt.pptx
cnn ppt.pptxcnn ppt.pptx
cnn ppt.pptx
rohithprabhas1
 
Excel review nd view tab
Excel review nd view tabExcel review nd view tab
Excel review nd view tab
rajnish ranjan
 
Excel review and view tab
Excel review and view tabExcel review and view tab
Excel review and view tab
abhijeet choudhary
 
Safe tutorial
Safe tutorialSafe tutorial
Safe tutorial
Ramil Artates
 
6 sigmaet 1 getting started
6 sigmaet   1 getting started6 sigmaet   1 getting started
6 sigmaet 1 getting started
Dr.Saurav Das
 
Ssis partitioning and best practices
Ssis partitioning and best practicesSsis partitioning and best practices
Ssis partitioning and best practices
Vinod Kumar
 
Django tutorial
Django tutorialDjango tutorial
Django tutorial
Ksd Che
 
PRML Chapter 7
PRML Chapter 7PRML Chapter 7
PRML Chapter 7
Sunwoo Kim
 
z/OSMF Workflow Editor Lab - Try it out on your z/OSMF system
z/OSMF Workflow Editor Lab - Try it out on your z/OSMF systemz/OSMF Workflow Editor Lab - Try it out on your z/OSMF system
z/OSMF Workflow Editor Lab - Try it out on your z/OSMF system
Marna Walle
 
House Price Estimation as a Function Fitting Problem with using ANN Approach
House Price Estimation as a Function Fitting Problem with using ANN ApproachHouse Price Estimation as a Function Fitting Problem with using ANN Approach
House Price Estimation as a Function Fitting Problem with using ANN ApproachYusuf Uzun
 
Variables in MIT App Inventor powerpoint
Variables in MIT App Inventor powerpointVariables in MIT App Inventor powerpoint
Variables in MIT App Inventor powerpoint
JohnLagman3
 

Similar to Segments in Graphics (20)

Segments, illumination models, color models and shading
Segments, illumination models, color models and shadingSegments, illumination models, color models and shading
Segments, illumination models, color models and shading
 
CG_U6_M1.pptx
CG_U6_M1.pptxCG_U6_M1.pptx
CG_U6_M1.pptx
 
Segment Structure Display List in Computer Graphics.pptx
Segment Structure Display List in Computer Graphics.pptxSegment Structure Display List in Computer Graphics.pptx
Segment Structure Display List in Computer Graphics.pptx
 
Visi progress
Visi progressVisi progress
Visi progress
 
GDE Lab 1 – Traffic Light Pg. 1 Lab 1 Traffic L.docx
GDE Lab 1 – Traffic Light  Pg. 1     Lab 1 Traffic L.docxGDE Lab 1 – Traffic Light  Pg. 1     Lab 1 Traffic L.docx
GDE Lab 1 – Traffic Light Pg. 1 Lab 1 Traffic L.docx
 
View Tab in Ms-Excel
View Tab in Ms-ExcelView Tab in Ms-Excel
View Tab in Ms-Excel
 
Goodbye Nightmare : Tops and Tricks for creating Layouts
Goodbye Nightmare : Tops and Tricks for creating LayoutsGoodbye Nightmare : Tops and Tricks for creating Layouts
Goodbye Nightmare : Tops and Tricks for creating Layouts
 
Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...
Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...
Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...
 
cnn ppt.pptx
cnn ppt.pptxcnn ppt.pptx
cnn ppt.pptx
 
Excel review nd view tab
Excel review nd view tabExcel review nd view tab
Excel review nd view tab
 
Excel review and view tab
Excel review and view tabExcel review and view tab
Excel review and view tab
 
a3.pdf
a3.pdfa3.pdf
a3.pdf
 
Safe tutorial
Safe tutorialSafe tutorial
Safe tutorial
 
6 sigmaet 1 getting started
6 sigmaet   1 getting started6 sigmaet   1 getting started
6 sigmaet 1 getting started
 
Ssis partitioning and best practices
Ssis partitioning and best practicesSsis partitioning and best practices
Ssis partitioning and best practices
 
Django tutorial
Django tutorialDjango tutorial
Django tutorial
 
PRML Chapter 7
PRML Chapter 7PRML Chapter 7
PRML Chapter 7
 
z/OSMF Workflow Editor Lab - Try it out on your z/OSMF system
z/OSMF Workflow Editor Lab - Try it out on your z/OSMF systemz/OSMF Workflow Editor Lab - Try it out on your z/OSMF system
z/OSMF Workflow Editor Lab - Try it out on your z/OSMF system
 
House Price Estimation as a Function Fitting Problem with using ANN Approach
House Price Estimation as a Function Fitting Problem with using ANN ApproachHouse Price Estimation as a Function Fitting Problem with using ANN Approach
House Price Estimation as a Function Fitting Problem with using ANN Approach
 
Variables in MIT App Inventor powerpoint
Variables in MIT App Inventor powerpointVariables in MIT App Inventor powerpoint
Variables in MIT App Inventor powerpoint
 

Recently uploaded

Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
SupreethSP4
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
Vijay Dialani, PhD
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 

Recently uploaded (20)

Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 

Segments in Graphics

  • 2. Introduction • To humans, an image is not just a random collection of pixels; it is a meaningful arrangement of regions and objects. • There also exits a variety of images: natural scenes, paintings, etc. Despite the large variations of these images, humans have no problem to interpret them. • The image information is stored in Display file. • Existing structure of display file does not satisfy the requirements of viewing image. Display image is modified to reflect the sub picture structure. To achieve this display file is divided into segments.
  • 3. The Segment table indicates the portion of the display file used to construct the picture Display File Segment Table Display
  • 5.  The segment table is formed by using arrays. An alternative approach is linked list  In case of arrays, maximum no. of segments that can be included in the segment table are equal to the length of the arrays. But with linked list there is no such limit on the maximum no. of segments; as list is dynamic  In linked List ordering is achieved by simply adjusting the links. In case of arrays we have to move actual segment information in the process of sorting the segments. Segment Start Segment Size Scale X Scale Y Color Link 3 4 2 5 Null/ Segment Number 1 2 For ordering the segment 3  The Disadvantage of linked list is that it requires more storage to hold the links and that it is costly to locate arbitrary cells.  In the linked list deleting the cell means changing two links.
  • 6. Display file Linked List OP X Y Link 1 2 2 .1 .5 5 3 1 .1 .1 2 4 5 2 .5 .5 9 6 7 2 .1 .5 0 8 9 2 .7 .5 7 10 Start=3
  • 7. Segment Creation  We Must give the segment name so that we can identify it.  For example say that there is segment no. 3, then all following MOVE and Line commands would belong to segment 3. We could then close segment 3 and open another.  First thing to create a segment is to check whether some other segment is open. We can not open two segments at the same time because we would not know to which segment we should assign the drawing instructions. If there is segment open, we have an error  Next we should select valid segment name and check whether there already exists a segment under this name. If so, we again have an error.  The first instruction belonging to this segment will be located at the next free storage area in the display file. The current size of the segment is zero since we have not actually entered any instructions into it yet.
  • 8. CREATE_SEGMENT(SEGMENT-NAME) Argument SEGMENT-NAME Global NOW-OPEN the name of currently open segment FREE the index of the next free display-file cell SEGMENT-START, SEGMENT-SEZE,VISIBILITY ANGLE, SCALE-X, SCALE-Y, TRANSLATE-X,TRANSLATE-Y Constant NUMBER-OF-SEGMENTS BEGIN IF NOW-OPEN>0 THEN RETURN ERROR ‘SEGMENT STILL OPEN’; IF SEGMENT-NAME < 1 OR SEGMENT-NAME > NUMBER-OF-SEGMENTS THEN RETURN ERROR ‘INVALID SEGMENT NAME’; IF SEGMENT-SIZE[SEGMENT-NAME]>0 THEN RETURN ERROR ‘SEGMENT ALREADY EXISTS’; SEGMENT-START[SEGMENT-NAME]<-FREE; SEGMENT-SIZE[SEGMENT-NAME]<-0; VISIBILITY[SEGMENT-NAME] <-VISIBILITY[0]; ANGLE[SEGMENT-NAME] <-ANGLE[0]; SCALE-X[SEGMENT-NAME]<-SCALE-X[0]; SCALE-Y[SEGMENT-NAME]<-SCALE-Y[0]; TRANSLATE-X[SEGMENT-NAME]<-TRANSLATE-X[0]; TRANSLATE-Y[SEGMENT-NAME]<-TRANSLATE-Y[0]; NOW-OPEN<-SEGMENT-NAME; RETURN; END;
  • 9. Closing a Segment • Once the drawing instructions are completed, we should close it. • NOW-OPEN variable indicates the name of the currently open segment. • To close a segment it is necessary to change the name of the currently open segment. It can be achieved by changing the name of currently open segment as 0. • We don’t have two unnamed segments around because we shall show only one of them and the other would just waist storage. • If there are two unnamed segments in the display file one has to be deleted.
  • 10. Algorithm to close Segment Global NOW-OPEN the name of currently open segment FREE the index of the next free display-file cell SEGMENT-START, SEGMENT-SIZE start and size of the segment BEGIN IF NOW-OPEN=0 THEN RETURN ERROR ‘NO SEGMENT IS OPEN’; DELETE-SEGMENT[0]; SEGMENT-START[0]<-FREE; SEGMENT-SIZE[0]<-0; NOW-OPEN<-0; RETURN; END;
  • 11. Deleting A Segment  When we want to delete a particular segment from the display file then we must recover the storage space occupied by its instructions and make this space free for some other segment. To do this we must not destroy and re- form the entire display file, but we must delete just one segment, while preserving the rest of the display file.  Here we have used arrays to store the display file information. Segment 1 Segment 2 Segment 3 Segment 4 Unused Space Segment 1 Segment 3 Segment 4 Unused Space
  • 12. Delete Algorithm 1. Read the name of the segment which is to be deleted. 2. Check whether the segment name is valid; if not display error “Segment not valid” go to step 8 3. Check whether the segment is open, if yes, display error message “ Can’t delete open segment” go to step 8. 4. Check whether the size of segment is greater than 0, if no, no processing is required as segment contains no instructions. 5. Shift the display file elements which follow the segment which is to be deleted by it’s size. 6. Recover the deleted space by resetting the index of the next free instruction. 7. Adjust the starting positions of the shifted segments by subtracting the size of the deleted segment from it. 8. Stop.
  • 13. Renaming a Segment • The display processor is continuously reading the display file and showing its contents • Suppose we wish to use this device to show an animated character moving on the display. • To display a new image in the sequence we have to delete the current segment and re-create it with the altered character. The problem in this process is that during the time after the first image is deleted and time before the second image is completely entered, only a partially completed character is displayed on the screen. • We avoid this problem by keeping the next image ready in the display file before deleting the current segment. • Segment which is to be deleted and segment which is to be replaced with must exist in display file at the same time. • We do this by building the new invisible image under some temporary segment name. When it is completed, we can delete the original image, make the replacement image visible, and rename the new segment to become the old segment to achieve apparent motion. • The idea of maintaining two images, one to show and one to build or alter, is called double buffering.
  • 14. Algorithm to Rename Segment 1. Check whether both old and new segment names are valid; if not display error message “Not valid segment names” and go to step 6. 2. Check whether any of the two segments are open. If open, display error message “Segment still open” and go to step 6. 3. Check whether the new name we are going to give to the old segment is not already existing in the display file. If yes, display error message “Segment already exists” and go to step 6. 4. Copy the old segment table entry into new position. 5. Delete the old segment. 6. Stop.
  • 15. Visibility -Each Segment is given a visibility attribute. -The segment’s visibility is stored in an array as part of the segment table. -By checking this array we can determine whether or not the segment should be displayed.