Graphic Shape Library

Company-Wide Library. ShapeChef enables you to create shared libraries that are accessible to an entire team or company. Using this feature, you can build a central repository for graphics and charts commonly used in your organization. 26000+ Icons & Illustrations to SVG, Lottie, React. Shape lets you customize the style, colors and border of static & animated icons and illustrations. You can export to React, SVG and Lottie code.

Page Stats

Visitor: 1174

Using C, C++ Graphics, we can create basic shapes like line, circle, rectangle, ellipse, arc, bar, bar3d, and display text. To use graphics functions, we must include graphics.h header file.

Line Function

Line function is used to draw a straight line, there are 4 parameters used in line function (x1,y1,x2,y2).

Example 1: Line function in C - Graphics. 172

Code Explanation:
  • graphics.h header file is must in all the programs, if you are using graphics functions.
  • initgraph is used to initialize the system graphics by loading a graphics driver from disk and thereby putting the system into graphics mode. initgraph takes 3 parameters: graphic detect, graphic mode, and bgi file path.
  • bgi stands for Borland Graphics Interface, it is a graphic library. This library loads graphic drivers and vector fonts (*.CHR).
  • closegraph deallocates the memory allocated by the system graphics and then restores the screen to the mode it was before calling initgraph.

Circle Function

Circle function is used to draw a circle which required 3 parameters i.e x, y and radius.

Example 2: WAP to draw a circle with radius of 80 pixels. 185

Graphic shape library for kindergarten

Example 3: WAP to draw a circle with radius of 80 pixels on the center of screen.

  • getmaxx It returns the maximum X coordinate
  • getmaxy It returns the maximum Y coordinate

Rectangle Function

Rectangle function is used to draw a rectangle which required 4 parameters i.e x1(left), y1(top), x2(right) and y2(bottom).

Example 4: Rectangle function in C - Graphics. 179

Ellipse Function

Ellipse function is used to draw a ellipse. Syntax: ellipse(int x, int y, int stangle, int endangle, int xradius, int yradius);

Example 5: Ellipse function in C - Graphics. 112

Arc Function

Arc function is used to draw a arc. Syntax: arc(int x, int y, int stangle, int endangle, int radius);

Graphic shape art

Example 6: Arc function in C - Graphics. 171

Bar Function

Bar function draws a rectangle and fill it with current fill pattern and color. Syntax: bar(int left, int top, int right, int bottom);

Example 7: Bar function in C - Graphics. 177

Bar3d Function

Bar3d function is used to draw a 2-dimensional rectangular filled in bar. Syntax:

Example 8: Bar3d function in C - Graphics. 118

Graphic Shape Library For Kids

Example 9: outtextxy function in C - Graphics. 106

Graphic shape library for teachers

Color functions in C Graphics

In C Graphics, there are 16 colors declared. We use colors to set background color, change color of shapes, fill color of shapes, change text color.

  1. textcolor is use to set the text color.
  2. setbkcolor is use to set the background color by specifying the color name or the number
  3. setcolor is use to set the text color or set the outline color of the various shapes.

Graphic Shape Library For Photoshop

List of available colors and their values
S.No.Color NameColor Value
BLACK0
BLUE1
GREEN2
CYAN3
RED4
MAGENTA5
BROWN6
LIGHTGRAY7
DARKGRAY8
LIGHTBLUE9
LIGHTGREEN10
LIGHTCYAN11
LIGHTRED12
LIGHTMAGENTA13
YELLOW14
WHITE15

Graphic Import Shape Library

Updated: 23-Jun-21