Skip to content

sudheeshps/dospaint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎨 DosPaint 2.0

Welcome to DosPaint 2.0! 🎉 This project is a nostalgic recreation of a paint application, originally developed in C and BGI as my college final year project back in 1999. 🕰️ After losing the original floppy disk, I meticulously re-typed the entire source code from printouts, successfully bringing this classic application back to life. 🚀

My long-standing wish was to rebuild it using C++, and with the advent of Generative AI, I finally embarked on this journey. This project serves as an exciting experiment in leveraging AI to revive and modernize legacy software. ✨ But this project is not simply owed to Gemini 🤖; my blood and sweat went into it a lot 😓. It was a pain to get it done with Gen AI 😖. Sometimes I took control by coding myself 🧑‍💻.

dospaint.png

Original UI (built in 1999 as part of college final project)

Original UI

📝 Table of Contents

📸 Screenshots

✨ Features

  • Drawing Tools: A variety of drawing tools, including freehand drawing, lines, circles, rectangles, and other shapes.
  • Color Palette: A selectable color palette for choosing drawing colors.
  • Toolbox: A toolbox for selecting different drawing tools and shapes.
  • Attribute Selection: Options to change attributes like line style and fill patterns.
  • Menu Bar (TODO): A menu bar with file and edit options.
  • Status Bar: A status bar to display current tool information and coordinates.
  • UI Components: A custom UI library with buttons, labels, and panels.

💻 Technology Stack

  • Programming Language: C++
  • Compiler: Turbo C++ 3.0
  • Graphics Library: Borland Graphics Interface (BGI)
  • Target Environment: DOS

🚀 Getting Started

📋 Prerequisites

  • Windows 11
  • A version of Turbo C++ 3.0 bundled with an emulator like DOSBox.

⬇️ Installation

  1. Download Turbo C++ 3.0: Download a version of Turbo C++ that is packaged for modern Windows systems. These downloads typically include the original Turbo C++ files and a pre-configured DOSBox emulator.
  2. Extract and Install:
    • If you have a previous version of Turbo C++ installed, uninstall it first.
    • Extract the downloaded .zip file.
    • Run the setup.exe or install.exe file and follow the on-screen instructions.
  3. Launch Turbo C++: A shortcut to Turbo C++ should be created on your desktop. Double-click it to launch the IDE.

⚙️ Configure BGI

  1. Open the Options Menu: In the Turbo C++ IDE, navigate to the Options menu.
  2. Set Directories:
    • Go to Options > Linker > Libraries and set the Graphics Library to On.
    • Go to Options > Directories and set the BGI path to C:\Turboc3\BGI (or the equivalent path in your installation).

🛠️ Building and Running the Application

  1. Open the Project: In the Turbo C++ IDE, go to Project > Open Project... and select the project file for this application.
  2. Compile the Code: Go to Compile > Make to compile the project.
  3. Don't forget to create the output folder (say "BIN") and configure it in editor otherwise build will fail
  4. Run the Application: Go to File->DOS Shell type "BIN\DOSPAINT.EXE" to execute the compiled application.

💡 How to Use BGI for Graphics

The Borland Graphics Interface (BGI) is a simple graphics library for DOS. Here's a basic example of how to create a simple graphics application: (there is sample BGIDEMO.C included in BGI folder for reference)

#include <graphics.h>
#include <conio.h>

int main() {
    // Initialize the graphics mode
    int gd = DETECT, gm;
    initgraph(&gd, &gm, "C:\\Turboc3\\BGI");

    // Check for errors
    if (graphresult() != grOk) {
        return -1;
    }

    // Draw a circle
    circle(320, 240, 100);

    // Wait for a key press
    getch();

    // Close the graphics mode
    closegraph();

    return 0;
}

🔑 Key BGI Functions

  • initgraph(): Initializes the graphics system.
  • closegraph(): Shuts down the graphics system.
  • graphresult(): Returns an error code for the last graphics operation.
  • Drawing functions like circle(), line(), rectangle(), etc.

🙏 Acknowledgements

This project was generated with the assistance of a large language model as an experiment in creating legacy software. The primary goal was to explore the capabilities of AI in understanding and generating code for older platforms and environments.

📄 License

This project is licensed under the MIT License.

Open points

  • 🧠 The memory management needs to be improved. There are smart pointers implemented that needs to be integrated.
  • ✨ There some painting issues or flickering that needs to be fixed.
  • 💾 The save and open features needs to be implemented. Save is partially done, just to see how to launch a dialog overlay.
  • 🖱️ The text box click and edit is not working some times.
  • 📜 Menu support needs to be added.

About

This application mimics Windows Paint on DOS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors