Skip to content

Commit f8b218e

Browse files
committed
Add Sample Project For Imaging Lib
1 parent da2826f commit f8b218e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+975
-0
lines changed

.vs/PA.ImageUtils/v16/.suo

52 KB
Binary file not shown.

.vs/ProjectSettings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"CurrentProjectSetting": null
3+
}

.vs/VSWorkspaceState.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"ExpandedNodes": [
3+
""
4+
],
5+
"SelectedNode": "\\PA.ImageUtils.sln",
6+
"PreviewInSolutionExplorer": false
7+
}

.vs/image-utils/v16/.suo

23.5 KB
Binary file not shown.

.vs/slnx.sqlite

324 KB
Binary file not shown.

PA.ImageUtils.Win/MainForm.Designer.cs

Lines changed: 207 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PA.ImageUtils.Win/MainForm.cs

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
using PA.PersianUtils.ImageUtils;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.ComponentModel;
5+
using System.Data;
6+
using System.Drawing;
7+
using System.Text;
8+
using System.Windows.Forms;
9+
10+
namespace PA.ImageUtils.Win
11+
{
12+
public partial class MainForm : Form
13+
{
14+
private string imageFileName;
15+
16+
public MainForm()
17+
{
18+
InitializeComponent();
19+
}
20+
21+
private void zoomButton_Click(object sender, EventArgs e)
22+
{
23+
zoomButton.Checked = !zoomButton.Checked;
24+
}
25+
26+
private void sourcePicturebox_MouseMove(object sender, MouseEventArgs e)
27+
{
28+
if (!zoomButton.Checked)
29+
{
30+
sourcePicturebox.Cursor = Cursors.Default;
31+
return;
32+
}
33+
sourcePicturebox.Cursor = Cursors.Cross;
34+
Image img = Imaging.ZoomImage(sourcePicturebox.Image, new Rectangle(e.X, e.Y, 200, 200), new Rectangle(0, 0, destpicturebox.Width, destpicturebox.Height));
35+
if (img != null)
36+
destpicturebox.Image = img;
37+
}
38+
39+
private void loadButton_Click(object sender, EventArgs e)
40+
{
41+
OpenFileDialog ofd = new OpenFileDialog();
42+
ofd.Filter = "Jpeg Files|*.jpg";
43+
if(ofd.ShowDialog() == DialogResult.OK)
44+
{
45+
imageFileName = ofd.FileName;
46+
sourcePicturebox.Image = Imaging.FromFile(imageFileName);
47+
}
48+
}
49+
50+
private void saveButton_Click(object sender, EventArgs e)
51+
{
52+
if (destpicturebox == null)
53+
return;
54+
SaveFileDialog sfd = new SaveFileDialog();
55+
sfd.Filter = "Jpeg Files|*.jpg";
56+
if (sfd.ShowDialog() == DialogResult.OK)
57+
{
58+
imageFileName = sfd.FileName;
59+
Imaging.Save(imageFileName,destpicturebox.Image);
60+
sourcePicturebox.Image = destpicturebox.Image;
61+
}
62+
}
63+
64+
private void srayscaleButton_Click(object sender, EventArgs e)
65+
{
66+
if (sourcePicturebox.Image == null)
67+
return;
68+
destpicturebox.Image = Imaging.MakeGrayscale((Bitmap)sourcePicturebox.Image);
69+
}
70+
71+
private void colorfulButton_Click(object sender, EventArgs e)
72+
{
73+
destpicturebox.Image = Imaging.ConvertImageToARGB(sourcePicturebox.Image);
74+
}
75+
76+
private void markAreaButton_Click(object sender, EventArgs e)
77+
{
78+
destpicturebox.Image = Imaging.MarkImage(sourcePicturebox.Image, new Rectangle(400, 200, 200, 200), Color.Purple);
79+
}
80+
81+
private void dominantColorButton_Click(object sender, EventArgs e)
82+
{
83+
colorPanel.BackColor = Imaging.GetDominantColor((Bitmap)sourcePicturebox.Image, false);
84+
}
85+
}
86+
}

0 commit comments

Comments
 (0)