Posts

Showing posts from May, 2021

Functions of graphics

Image
 • First will discuss basic geometric shapes and base on that we will make a simple program where we will have a x and y axis and all the shapes in it. 1) Line Function => line function is used to draw a line by just giving 4 points. syntax:       void line(int x1, int y1, int x2, int y2); Where:          x1 : initial x-coordinate        y1 : intial  y-coordinate        x2 : end x-coordinate        y2 : end y-coordinate Example    : line(100, 100, 200, 200); Explanation : A line would be drawn from point(100, 100) to point(200,200). 2) Rectangle Function => Rectangle function is used to draw a rectangle.  => Rectangle function is same as bar function already discussed in last post, only difference is in bar function we get only 3 lines in output, but in rectangle we get all the four lines. =>Coordinates of left top and right bottom corner are required to draw the rectangle. left specifies the X-coordinate of top left corner, top specifies the Y-coordinate of top left corne