Small C Language Program to show the drawing and filling of some basic shapes like rectangle, circle etc. with colors and different shades. First we created a characters array of patterns that will fill the drawing, then initialize the graphics mode and the draw the shapes.

Note: The graphics.h library and functions used in this code are specific to the Turbo C compiler. Modern compilers might not support these graphics functions directly. We have re-written the same C source code by using a more modern graphics library called SDL (Simple DirectMedia Layer), which is cross-platform and widely used for multimedia applications, including graphics.

By using graphics.h Library

By using SDL Graphics Library

The SDL library provides a different approach to graphics than the traditional BGI graphics. In this example we draw rectangles directly onto the window using the SDL rendering functions. Additionally, SDL does not have built-in text rendering so we used a separate library called SDL_ttf for text rendering, as demonstrated in the code.