0% found this document useful (0 votes)
60 views11 pages

Computer Graphics (CGR)

Computer graphics are composed of basic graphical elements called output primitives. The main output primitives are pixels, lines, rectangles, circles, and ellipses. A line is defined by its starting and ending points. A circle is defined by its center point and radius. A rectangle is defined by its top-left and bottom-right coordinates. An ellipse is similar to a circle but its radii can differ on the x- and y-axes. Each primitive requires specific attributes, like coordinates and dimensions, to render its geometric shape.

Uploaded by

Prajkta Ahirrao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views11 pages

Computer Graphics (CGR)

Computer graphics are composed of basic graphical elements called output primitives. The main output primitives are pixels, lines, rectangles, circles, and ellipses. A line is defined by its starting and ending points. A circle is defined by its center point and radius. A rectangle is defined by its top-left and bottom-right coordinates. An ellipse is similar to a circle but its radii can differ on the x- and y-axes. Each primitive requires specific attributes, like coordinates and dimensions, to render its geometric shape.

Uploaded by

Prajkta Ahirrao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Computer Graphics(CGR)

OUTPUT PRIMITIVES
Output Primitives
 Computer graphics are made up of basic components of
Computer Graphics that are called as Graphic Output
Primitives.
 The primitives are the simple geometric functions that are
used to generate various Computer Graphics required by
the user.
 Some of the output primitives are pixel, straight line,
rectangle, circle, ellipse, etc.
Line Function

 It consists of two pixels or points one is starting


point and another is the ending point.
 It is drawn using two co-ordinates or we can say for
parameters that is (X1,Y1) and another is (X2,Y2).
Attributes to draw a line
 To draw a line we need attributes like co-ordinates (x1,y1), (x2,y2),
line colour, and sometimes we can consider the width of the line too.
 We give this function like ,
line(int x1, int y1, int x2, int y2);
(x1, y1)- Starting point
(x2, y2)- Ending point
 Example: line(200,100,300,100);

(X1, Y1) (X2, Y2)


Fig. A
Circle Function

 Circle function is used to draw a circle with center (x, y) and


radius of a circle.
 It has only one co-ordinate as its starting point and ending point
are at a same location and radius is required to measured the
size of circle.
Attributes to draw a Circle

 We represent this function like:


circle(int x, int y, int radius);
(x, y)- Starting and ending points of a circle
 Example: circle (300,200,40)

Fig. B (300,200)
r (40)
Rectangle Function
 Rectangle function is used to draw a rectangle. It has four co-
ordinates.
 Co-ordinates of left top and right bottom, corner are required
to draw the rectangle

300 400

600 Fig. C 500


Attributes to draw a rectangle
 We represent this function like:
rectangle (int left, int top, int right, int bottom)
int left– co-ordinates at the left of rectangle
int top– co-ordinates at the top of rectangle
int right- co-ordinates at the right of rectangle
int bottom- co-ordinates at the bottom of rectangle
 Example: rectangle (300,400,500,600)
Ellipse Function

 Ellipse is a bit similar to circle but not a circle, As circle as


infinite axis and ellipse has only two axis of different length.
 If we want vertical ellipse figure, we have to focus more or
extend the length of the co-ordinates of the y- axis so that its
get elongated.
 And on the other hand if we want a horizontal ellipse figure, we
have to exact vice-versa of the above process.
Attributes to draw an ellipse
 We represented this function like:
ellipse (int x, int y, start angle, end angle, int x radius,
int y radius);
 Ellipse is drawn with center (x, y), starting angle, end angle,
radius of x and y axis
 Example: ellipse( 150, 200, 0, 360, 20, 40)

Fig. D
THANKS TO ALL
Created by: Samiksha More & Chetan Mahajan

You might also like