2
Most read
3
Most read
5
Most read
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

PPTX
ACCIDENT PREVENTION AND DETECTION SYSTEM
PDF
Web Technologies Notes - TutorialsDuniya.pdf
PPTX
3D printer Technology _ A complete presentation
PPTX
Html coding
PPTX
Concurrency Control in Distributed Database.
PPT
2D transformation (Computer Graphics)
PPTX
Edge Computing.pptx
ACCIDENT PREVENTION AND DETECTION SYSTEM
Web Technologies Notes - TutorialsDuniya.pdf
3D printer Technology _ A complete presentation
Html coding
Concurrency Control in Distributed Database.
2D transformation (Computer Graphics)
Edge Computing.pptx

What's hot (20)

PPTX
2D viewing & clipping
PDF
3D Transformation
PPTX
Line Drawing Algorithms - Computer Graphics - Notes
PPT
Shading
PPT
Z buffer
PDF
Production System in AI
PPTX
Graphics_3D viewing
PPT
Heuristic Search Techniques {Artificial Intelligence}
PPTX
Cyrus beck line clipping algorithm
PPTX
Back face detection
PPTX
Attributes of output primitives( curve attributes & area fill attributes)
PPTX
Polygons - Computer Graphics - Notes
PPTX
Cohen sutherland line clipping
PDF
Computer graphics curves and surfaces (1)
PPTX
Hill climbing algorithm
PPTX
Shading methods
PPTX
BRESENHAM’S LINE DRAWING ALGORITHM
PPTX
Clipping in Computer Graphics
PPTX
Attributes of Output Primitives
PPTX
Means End Analysis (MEA) in Artificial.pptx
2D viewing & clipping
3D Transformation
Line Drawing Algorithms - Computer Graphics - Notes
Shading
Z buffer
Production System in AI
Graphics_3D viewing
Heuristic Search Techniques {Artificial Intelligence}
Cyrus beck line clipping algorithm
Back face detection
Attributes of output primitives( curve attributes & area fill attributes)
Polygons - Computer Graphics - Notes
Cohen sutherland line clipping
Computer graphics curves and surfaces (1)
Hill climbing algorithm
Shading methods
BRESENHAM’S LINE DRAWING ALGORITHM
Clipping in Computer Graphics
Attributes of Output Primitives
Means End Analysis (MEA) in Artificial.pptx
Ad

Similar to Segments in Graphics (20)

PPTX
Segments, illumination models, color models and shading
PPTX
CG_U6_M1.pptx
PPTX
Segment Structure Display List in Computer Graphics.pptx
PDF
Visi progress
DOCX
GDE Lab 1 – Traffic Light Pg. 1 Lab 1 Traffic L.docx
PPTX
View Tab in Ms-Excel
PDF
Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...
PDF
Goodbye Nightmare : Tops and Tricks for creating Layouts
PPTX
cnn ppt.pptx
PPTX
Excel review nd view tab
PPTX
Excel review and view tab
PDF
a3.pdf
PDF
Safe tutorial
PDF
6 sigmaet 1 getting started
DOCX
Ssis partitioning and best practices
PPTX
Lecture. COMPUTER AIDED ENGINEERING L.pptx
PDF
Django tutorial
PPTX
PRML Chapter 7
PDF
z/OSMF Workflow Editor Lab - Try it out on your z/OSMF system
PPTX
Computer architeu from fpt university 2000
Segments, illumination models, color models and shading
CG_U6_M1.pptx
Segment Structure Display List in Computer Graphics.pptx
Visi progress
GDE Lab 1 – Traffic Light Pg. 1 Lab 1 Traffic L.docx
View Tab in Ms-Excel
Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...
Goodbye Nightmare : Tops and Tricks for creating Layouts
cnn ppt.pptx
Excel review nd view tab
Excel review and view tab
a3.pdf
Safe tutorial
6 sigmaet 1 getting started
Ssis partitioning and best practices
Lecture. COMPUTER AIDED ENGINEERING L.pptx
Django tutorial
PRML Chapter 7
z/OSMF Workflow Editor Lab - Try it out on your z/OSMF system
Computer architeu from fpt university 2000
Ad

Recently uploaded (20)

PDF
LOW POWER CLASS AB SI POWER AMPLIFIER FOR WIRELESS MEDICAL SENSOR NETWORK
PDF
distributed database system" (DDBS) is often used to refer to both the distri...
PPTX
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
PPTX
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
PPTX
Management Information system : MIS-e-Business Systems.pptx
PDF
UEFA_Carbon_Footprint_Calculator_Methology_2.0.pdf
PPTX
Principal presentation for NAAC (1).pptx
PPTX
Building constraction Conveyance of water.pptx
PDF
Applications of Equal_Area_Criterion.pdf
PDF
Implantable Drug Delivery System_NDDS_BPHARMACY__SEM VII_PCI .pdf
PDF
Unit1 - AIML Chapter 1 concept and ethics
PPTX
Chapter 2 -Technology and Enginerring Materials + Composites.pptx
PDF
Soil Improvement Techniques Note - Rabbi
PDF
Prof. Dr. KAYIHURA A. SILAS MUNYANEZA, PhD..pdf
PPTX
A Brief Introduction to IoT- Smart Objects: The "Things" in IoT
PPTX
CyberSecurity Mobile and Wireless Devices
PDF
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
PPTX
Information Storage and Retrieval Techniques Unit III
PDF
Accra-Kumasi Expressway - Prefeasibility Report Volume 1 of 7.11.2018.pdf
PPTX
Graph Data Structures with Types, Traversals, Connectivity, and Real-Life App...
LOW POWER CLASS AB SI POWER AMPLIFIER FOR WIRELESS MEDICAL SENSOR NETWORK
distributed database system" (DDBS) is often used to refer to both the distri...
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
Management Information system : MIS-e-Business Systems.pptx
UEFA_Carbon_Footprint_Calculator_Methology_2.0.pdf
Principal presentation for NAAC (1).pptx
Building constraction Conveyance of water.pptx
Applications of Equal_Area_Criterion.pdf
Implantable Drug Delivery System_NDDS_BPHARMACY__SEM VII_PCI .pdf
Unit1 - AIML Chapter 1 concept and ethics
Chapter 2 -Technology and Enginerring Materials + Composites.pptx
Soil Improvement Techniques Note - Rabbi
Prof. Dr. KAYIHURA A. SILAS MUNYANEZA, PhD..pdf
A Brief Introduction to IoT- Smart Objects: The "Things" in IoT
CyberSecurity Mobile and Wireless Devices
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
Information Storage and Retrieval Techniques Unit III
Accra-Kumasi Expressway - Prefeasibility Report Volume 1 of 7.11.2018.pdf
Graph Data Structures with Types, Traversals, Connectivity, and Real-Life App...

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.