Skip to content

Commit

Permalink
Final
Browse files Browse the repository at this point in the history
  • Loading branch information
Hri7566 committed Sep 2, 2023
1 parent 46b0af4 commit 5c4b6a6
Show file tree
Hide file tree
Showing 11 changed files with 101 additions and 54 deletions.
12 changes: 6 additions & 6 deletions BadPaint/BadPaint.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,9 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\dirt01.jpg" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\carpet.jpg" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\FillTool_204_32.bmp" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Fill.png" />
</ItemGroup>
Expand All @@ -102,5 +96,11 @@
<ItemGroup>
<None Include="Resources\Open_6529.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\arcade_carpet_1_512.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\carpet_2_256.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
18 changes: 14 additions & 4 deletions BadPaint/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions BadPaint/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,22 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Open_6529" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Open_6529.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="arcade_carpet_1_512" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\arcade_carpet_1_512.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Save_6530" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Save_6530.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="FillTool_204_32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\FillTool_204_32.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="carpet" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\carpet.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Fill" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Fill.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Open_6529" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Open_6529.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="carpet_2_256" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\carpet_2_256.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
Binary file removed BadPaint/Resources/FillTool_204_32.bmp
Binary file not shown.
Binary file added BadPaint/Resources/arcade_carpet_1_512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BadPaint/Resources/carpet_2_256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed BadPaint/Resources/dirt01.jpg
Binary file not shown.
7 changes: 4 additions & 3 deletions BadPaint/frmBadPaint.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 27 additions & 12 deletions BadPaint/frmBadPaint.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;

namespace BadPaint
{
Expand All @@ -21,8 +16,8 @@ public partial class frmBadPaint : Form
public Pen currentPen;

public int cursorX, cursorY = -1;
public bool mouseHeld = false;
public int lineWidth = 7;
public bool drawing = false;
public int lineWidth = 5;

public List<List<Color>> palettes;
public List<PictureBox> paletteBoxes;
Expand All @@ -33,6 +28,9 @@ public frmBadPaint()
{
InitializeComponent();

// Set line width component value
nudLineWidth.Value = lineWidth;

// Setup image buffer
imageBuffer = new Bitmap(pnlCanvas.Width, pnlCanvas.Height);

Expand Down Expand Up @@ -74,11 +72,19 @@ public frmBadPaint()
// Setup palettes
palettes = new List<List<Color>>();
addPalettes();

// Count colors (debug)
int count = 0;
foreach (List<Color> pal in palettes)
{
count += pal.Count;
}
Console.WriteLine(count);
}

private void pnlCanvas_MouseDown(object sender, MouseEventArgs e)
{
mouseHeld = true;
drawing = true;

if (e.Button == MouseButtons.Right)
{
Expand All @@ -97,14 +103,14 @@ private void pnlCanvas_MouseDown(object sender, MouseEventArgs e)

private void pnlCanvas_MouseUp(object sender, MouseEventArgs e)
{
mouseHeld = false;
cursorX = -1;
cursorY = -1;
drawing = false;
cursorX = 0;
cursorY = 0;
}

private void pnlCanvas_MouseMove(object sender, MouseEventArgs e)
{
if (cursorX != -1 && cursorY != -1 && mouseHeld)
if (cursorX != 0 && cursorY != 0 && drawing)
{
// Draw line
graphics.DrawLine(currentPen, new Point(cursorX, cursorY), e.Location);
Expand Down Expand Up @@ -286,8 +292,17 @@ private void boxOpen_Click(object sender, EventArgs e)
}
}

private void pnlConfig_Paint(object sender, PaintEventArgs e)
{

}

public void addPalettes()
{
// Generate palette information
// Web color list from Wikipedia
// https://en.wikipedia.org/wiki/Web_colors

// HTML
palettes.Add(new List<Color> { Color.White, Color.Silver, Color.Gray, Color.Black, Color.Red, Color.Maroon, Color.Yellow, Color.Olive, Color.Lime, Color.Green, Color.Aqua, Color.Teal, Color.Blue, Color.Navy, Color.Fuchsia, Color.Purple });

Expand Down
24 changes: 1 addition & 23 deletions BadPaint/frmBadPaint.resx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
<data name="boxFill.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAA6/AAAOvwE4BVMkAAABt0lE
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAA68AAAOvAGVvHJJAAABt0lE
QVQ4T7WQTStEURjHzyApK6UG4955i8X1UiYLG02x9FIW1jIfwMvInQXJNyAsRJkZOxs7GwnNpEkyxdjQ
bJSXsbCRRlH4netoxqVseOrf85xznt//nPOIPw2n01np8XgWvV7vDfmOvOl2uzvU8e8BMI82NE2rw6Cf
Oo9eqU/QDGYVqvXnkLfqul6LAoD3rKepfdR9aIt1xufz6ar9e9D0SEMXjTn0ImFlaIm9OXRuGEa5Qr4G
Expand All @@ -139,28 +139,6 @@
UnXtnVpJeDkMfI0uLINI9BLTIYVbBhmae+1wsYCOMDi1DCbJcv0ZGIyibTnln2DOhhwTq3mgpHoBOZpX
uBDBYLCMpiRDnLebSBjlSkcWD/l3llckMMhikFD4RwDX0HjC8HYAe8mNaFzCrAPW0CQkb5Z5ak1TaCEw
qQAw0RnwE0ox3BZ1/B8hxDtffKitU71fhAAAAABJRU5ErkJggg==
</value>
</data>
<data name="boxFill.InitialImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
Qk02BAAAAAAAADYAAAAoAAAAEAAAABAAAAABACAAAAAAAAAAAADEDgAAxA4AAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAD29vb/9vb2//b29v/29vb/9vb2//b29v8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAPb29v/29vb/ycnJ/2RkZP9CQkL/QkJC/7Ozs//29vb/9vb2//b29v/29vb/9vb2/wAA
AAAAAAAAAAAAAPb29v/29vb/kZGR/0JCQv9CQkL/QkJC/0JCQv9CQkL/s7Oz//b29v/29vb/nJyc//b2
9v8AAAAAAAAAAAAAAAD29vb/kZGR/0JCQv9CQkL/QkJC/0JCQv9CQkL/QkJC/0JCQv+zs7P/9vb2/0JC
Qv/29vb/AAAAAAAAAAD29vb/ycnJ/0JCQv9CQkL/QkJC/0JCQv9CQkL/QkJC/0JCQv9CQkL/QkJC/7Oz
s/9CQkL/9vb2/wAAAAAAAAAA9vb2/2RkZP9CQkL/QkJC/0JCQv9CQkL/QkJC/0JCQv9CQkL/QkJC/0JC
Qv9CQkL/QkJC//b29v8AAAAA7+/vEPb29v9CQkL/hoaG/8nJyf+Ghob/QkJC/0JCQv9CQkL/QkJC/0JC
Qv9CQkL/QkJC/0JCQv/29vb/AAAAAO/v7xD29vb/QkJC/+Dg4P9CQkL/4ODg/0JCQv9CQkL/QkJC/4SD
g/+amZn/QkJC/0JCQv9CQkL/9vb2/wAAAAAAAAAA9vb2/7Ozs//29vb/QkJC//b29v9CQkL/QkJC/4SD
g//x7/D/WFhY/0JCQv9CQkL/ZGRk//b29v8AAAAAAAAAAPb29v/29vb/9vb2/0JCQv/29vb/QkJC/1hY
WP/m5OX/8e/w/4+Ojv+Pjo7/r66v/8nJyf/29vb/AAAAAAAAAAAAAAAA9vb2//b29v9CQkL/9vb2/0JC
Qv+ko6T/8e/w//Hv8P/x7/D/0M/P/5ycnP/29vb/AAAAAAAAAAAAAAAAAAAAAAAAAAD29vb/QkJC//b2
9v9CQkL/xcTF//Hv8P/x7/D/urm6/5ycnP/29vb/9vb2/wAAAAAAAAAAAAAAAAAAAAAAAAAA9vb2/0JC
Qv++vr7/s7Oz/3l4eP+amZn/hYSE/8nJyf/29vb/9vb2/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPb2
9v9vb2//ZGRk/76+vv/Jycn/ycnJ/9TU1P/29vb/9vb2/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAD29vb/6+vr/29vb/9CQkL/QkJC/29vb//r6+v/9vb2/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAPb29v/29vb/9vb2//b29v/29vb/9vb2/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==
</value>
</data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
Expand Down
42 changes: 41 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
# BadPaint
#### Video Demo: https://www.youtube.com/watch?v=gFGA0INf0iU
#### Description:
BadPaint is a basic paint program written in C# with .NET as a Windows Forms application. It's designed to work with Windows 10 and up.

A bad paint program written in C# with .NET and Win32 forms.
## The idea

As usual, I wanted to challenge myself. My inspiration for this project leads to messing around with Mario Paint and mspaint. I believe in the idea that art should be a fun experience, but I usually find myself frustrated. Of course, my little paint program isn't going to overtake Photoshop or GIMP over the span of a few days. I watched a few YouTube videos on others creating Windows Forms apps and making their own art programs, so I took the liberty to try it for myself.

This wasn't originally going to be my final project, but I'm afraid the original idea I had is a bit too ambitious to finish without sloppy decisions.

## Features

### Pens

BadPaint has two pens bound to the left and right mouse buttons. Currently, these pens are the only tool available.

### Line Width

The line width of both pens is controlled by the numerical input labeled "Line Width" on the right of the config panel at the top right. A valid line width consists of an integer between 0 and 100 inclusive.

### Color Palette

The color of the pens can be changed by clicking the corresponding mouse button on the chosen color. Both pens store their own color.

A custom color can be chosen by clicking the "!" button on the custom color chooser. Once a color is chosen from the dialog, the color box itself can be clicked in the same manner as other palette boxes to choose the color.

### Saving

To save the image, click the top button with a floppy icon. A dialog will appear to save the file as a PNG.

### Loading

To load an image, click the bottom button with a folder icon. A dialog will appear to load an image file. At this moment in time, cancelling this operation will cause a crash.

### Fill button

The fill button will fill the entire document with the pen color corresponding to the mouse button pressed.

## Credits & Acknowledgements

Arcade textures - https://opengameart.org/content/arcade-carpet-textures
Color palette - https://en.wikipedia.org/wiki/Web_colors

0 comments on commit 5c4b6a6

Please sign in to comment.