primitive graphics

Download Primitive Graphics

Post on 21-Apr-2015

28 views

Category:

Documents

4 download

Embed Size (px)

TRANSCRIPT

GRAPHICS PRIMITIVESDISPLAY DEVICES PRIMITIVE OPERATIONS DISPLAY FILE INTERPRETER

NORMALISED DEVICED COORDINATESDISPLAY FILE STRUCTRURE AND ALGORITHMS TEXT AND LINE STYLE PRIMITIVES

PRESENTED BYNAME TULIKA BHARDWAJ SHARVARI KAPDI MANOJ SHRIWASTAVA ROHIT KOUL ROLL NO 04 19 48 22

PRIMITIVE OPERATIONSGraphics system offer a similar set of graphics primitive commands. The first primitive command we shall consider is that for drawing s line segment.

COMMANDS:

LINE-ABS-2(X,Y)LINE-REL-2(DX,DY) MOVE-ABS-2(X,Y) MOVE-REL-2(DX,DY)

DISPLAY FILE INTERPRETER

It contain the information necessary to construct the picture. The information will be in the form of instructions such as draw a line or move a line. Each instructions indicates a MOVE or a LINE, action for the display device.

We use display file interpreter to convert these instructions into actual images.

DISPLAY FILE AND INTERPRETER

USER PROGRAM

DISPLAY FILE

INTERPRETE R

DISPLAY

FEATURES:

Portability Interpreter converts standard display instructions to the actions of the particular device. Such files of imaging instructions are called as metafiles

UNIVERSITY QUESTIONS:

Create a display file for the following images display device having dimensions Xmin=10,Ymin=7,Xmax=35,Ymax=42(5,10) (22,10) (16,15) (15,18) (5,18) (13,31) (29,31) Xmax,Ymax (32,15)

Xmin,Ymin

NORMALIZED DEVICE COORDINATES:

Different display devices may have different screen sizes as measured in pixel.The device independent units are called normalized device coordinates. In these units the screen measures 1 unit wide and 1 unit height.

(0,1)

(1,1)

(0,0)

(1,0)

CONTD:

Suppose that for the actual display the index of the leftmost pixel is WIDTH-START and there are WIDTH pixels in the horizontal direction.Suppose also that the bottommost pixel is HEIGHTSTART and the number of pixels in the vertical direction is HEIGHT

CALCULATING ACTUAL COORDINATES

For horizontal dirction: Xs=WIDTH* Xn +WIDTH -START For vertical direction: Ys =HEIGHT*Yn+HEIGHT- START

UNIVERSITY QUESTION:

Represent the given image in normalized coordinates. Consider the current boundary parameters of the screen be Xmin=10,Ymin=10,Xmax=250,Ymax=250(100,80)

(50,100) (70,100)

(130,100)

(150,100)

(70,200)

(130,200)

DISPLAY FILE STRUCTUREEach display file consists of two parts.oo

Operation code (opcode) :- It indicates what type of command it is (e.g. LINE or MOVE). Operand :- They represent the coordinates of a point (x,y).

To store the instruction we use three separate arrays.

One for the operation code (DF-OP). One for the X- coordinate (DF-X). One for the Y- coordinate (DF-Y).

The Display must be large enough to hold all the commands needed to create our image.

ALGORITHM PUT-POINT(OP ,X ,Y)Place an instruction into the display file Arguments OP , X,Y the instruction to be entered Global DF-OP,DF-X,DF-Y, the three display file arrays. FREE the position of the next free cell. Constant DFSIZE the length of the display-file arrays. Begin IF FREE> DFSIZE THEN RETURN ERROR DISPLAY-FILE FULL;

DF-OP[FREE]

Recommended

View more >