A modern C++ application for creating 2D graphics using various drawing algorithms. Built with raylib for GUI rendering.
-
📝 Line Drawing Algorithms
- DDA
- Bresenham
- Parametric
- Colored Parametric
-
⭕ Circle Drawing
- Cartesian
- Polar
- Polar Iterative
- MidPoint DDA
- Enhanced MidPoint DDA
-
🔄 Ellipse Drawing
- Cartesian
- Polar
- Polar Iterative
- MidPoint
- MidPoint DDA
-
📊 Curve Drawing
- Quadratic Curves
- Bezier Curves
- Hermite Curves
- Cardinal Spline
-
🎯 Fill Algorithms
- Flood Fill
- Convex Fill
This application uses a modular structure for scalability and clarity. Below is a class diagram of key components.
-
GUI (
src/ui/GUI.cpp)- Main application controller
- Handles window management
- Coordinates user input
-
DrawingState (
src/core/DrawingState.cpp)- Manages drawing state
- Stores shapes and points
- Handles color management
-
MenuBar (
src/ui/components/MenuBar.cpp)- Handles menu interactions
- Manages algorithm selection
- Controls file operations
-
FileManager (
src/utils/FileManager.cpp)- Handles saving/loading drawings
- Manages file serialization
src/
|── public/
│ ├── class diagram.png
│ └── project overview.png
├── core/ # Core application logic
│ └── DrawingState.cpp # Manages drawing state
├── ui/ # User interface components
│ ├── components/ # Reusable UI elements
│ | └── MenuBar.cpp
│ |── config/ # UI configuration
| | |── MenuItem.h
│ | └── MenuConfig.h
│ └── GUI.cpp # Main GUI controller
├── utils/ # Utility classes
│ ├── FileManager.cpp # File operations
│ └── Exceptions.h # Custom exceptions
├── algorithms/ # Drawing algorithms
│ ├── LineDrawingAlgos/
│ ├── CircleDrawingAlgos/
│ ├── EllipseDrawingAlgos/
│ └── FillingAlgos/
└── main.cpp # Entry point of the application
- C++ compiler (MinGW-w64 or MSVC)
- raylib library
- Clone the repository
git clone https://github.com/yourusername/2d-drawing-program.git
cd 2d-drawing-program- Install raylib
- Download from Raylib's GitHub releases
- Extract to
C:\raylib
- Build the project using tasks.json file
CTRL+SHIFT+B
- Run the program
.\game.exe- Launch the application
- Use the top menu to select drawing algorithms
- Click on the canvas to place points
- Use save/load buttons to manage your drawings
- Memory Management: Modern C++ with smart pointers
- OOP practices:
- Factory Pattern for algorithms
- SOLID principles for maintainability
- Error Handling: Custom exceptions for file operations and drawing errors
This project is licensed under the MIT License - see the LICENSE file for details.
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
- raylib for the awesome graphics library
- Computer Graphics course materials and references

