The task is to write a C program to draw a Heart using graphics in C.
Approach: To run the program we have the include the below header file:
We will create a Heart with the help below functions:
- rectangle(x1,y1,x2,y2): A function from graphics.h header file is responsible for creating rectangle on the screen.
- ellipse(x,y,a1,a2,r1,r2): A function from graphics.h header file is responsible for creating ellipse on the screen.
- line(x1,y1,x2,y2): A function from graphics.h header file which draw a line.
- setfillstyle(pattern, color): The header file graphics.h contains setfillstyle() function which sets the current fill pattern and fills color.
- floodfill(pattern, color): function is used to fill an enclosed area. The current fill pattern and fill color is used to fill the area.
Below is the implementation of to draw Heart using graphics in C:
- Printing Heart Pattern in C
- C Program to create a House using Graphics
- Creating a Rainbow using Graphics Programming in C
- Sierpinski Triangle using Graphics
- Flood fill algorithm using C graphics
- Draw a moving car using computer graphics programming in C
- Creating Butterfly themed Fractal in C++ Using Graphics
- Mandlebrot Set in C/C++ Using Graphics
- Julia Fractal set in C/C++ Using Graphics
- Draw a Chess Board using Graphics Programming in C
- Draw a smiley face using Graphics in C language
- Represent Tree using graphics in C/C++
- DDA Line generation Algorithm in Computer Graphics
- Point Clipping Algorithm in Computer Graphics
- How to add "graphics.h" C/C++ library to gcc compiler in Linux
- 2D Transformation in Computer Graphics | Set 1 (Scaling of Objects)
- Translation of objects in computer graphics
- Vector vs Raster Graphics
- Draw ellipse in C graphics
- Draw a line in C++ graphics
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.