Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Drawing Graphics by using C Programing Language

Drawing Graphics by using C Programing Language

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.

Beginning C++23
Kickstart your coding journey with Beginning C++23 – the ultimate guide to mastering the latest in modern C++ programming!
View on Amazon

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.

About The Author

M. Saqib

Saqib is Master-level Senior Software Engineer with over 14 years of experience in designing and developing large-scale software and web applications. He has more than eight years experience of leading software development teams. Saqib provides consultancy to develop software systems and web services for Fortune 500 companies. He has hands-on experience in C/C++ Java, JavaScript, PHP and .NET Technologies. Saqib owns and write contents on mycplus.com since 2004.