-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIconProvider.cs
More file actions
180 lines (171 loc) · 6.69 KB
/
Copy pathIconProvider.cs
File metadata and controls
180 lines (171 loc) · 6.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
using System.Drawing;
using System.Drawing.Drawing2D;
public static class IconProvider
{
public static Bitmap CreateIcon(int size, Color bgColor, string letter, Color textColor)
{
var bmp = new Bitmap(size, size);
using (Graphics g = Graphics.FromImage(bmp))
{
g.SmoothingMode = SmoothingMode.AntiAlias;
using (Brush bg = new SolidBrush(bgColor))
using (Font font = new Font("Segoe UI", size * 0.45f, FontStyle.Bold))
{
g.FillEllipse(bg, 2, 2, size - 4, size - 4);
StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Center;
sf.LineAlignment = StringAlignment.Center;
using (Brush tb = new SolidBrush(textColor))
g.DrawString(letter, font, tb, new Rectangle(0, 0, size, size), sf);
}
}
return bmp;
}
public static Bitmap CreateAppIcon(int size)
{
var bmp = new Bitmap(size, size);
using (Graphics g = Graphics.FromImage(bmp))
{
g.SmoothingMode = SmoothingMode.AntiAlias;
using (Brush bg = new LinearGradientBrush(
new Point(0, 0), new Point(size, size),
Color.FromArgb(50, 100, 200), Color.FromArgb(100, 50, 180)))
{
g.FillRectangle(bg, 0, 0, size, size);
}
using (Font font = new Font("Segoe UI", size * 0.35f, FontStyle.Bold))
{
StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Center;
sf.LineAlignment = StringAlignment.Center;
using (Brush tb = new SolidBrush(Color.White))
g.DrawString("RM", font, tb, new Rectangle(0, 0, size, size), sf);
}
using (Pen p = new Pen(Color.FromArgb(80, Color.White), 2))
{
g.DrawRectangle(p, 1, 1, size - 3, size - 3);
}
}
return bmp;
}
public static Bitmap CreatePlayIcon(int size)
{
var bmp = new Bitmap(size, size);
using (Graphics g = Graphics.FromImage(bmp))
{
g.SmoothingMode = SmoothingMode.AntiAlias;
using (Brush bg = new SolidBrush(Color.FromArgb(0, 180, 80)))
g.FillEllipse(bg, 2, 2, size - 4, size - 4);
Point[] triangle = new Point[]
{
new Point(size / 3 + 2, size / 4),
new Point(size / 3 + 2, size * 3 / 4),
new Point(size * 2 / 3 + 2, size / 2)
};
using (Brush tb = new SolidBrush(Color.White))
g.FillPolygon(tb, triangle);
}
return bmp;
}
public static Bitmap CreateGuestIcon(int size)
{
var bmp = new Bitmap(size, size);
using (Graphics g = Graphics.FromImage(bmp))
{
g.SmoothingMode = SmoothingMode.AntiAlias;
using (Brush bg = new SolidBrush(Color.FromArgb(200, 150, 50)))
g.FillEllipse(bg, 2, 2, size - 4, size - 4);
using (Pen p = new Pen(Color.White, 2))
{
g.DrawEllipse(p, size / 3, size / 5, size / 3, size / 3);
int cx = size / 2;
int cy = size * 3 / 5;
int r = size / 3;
g.DrawArc(p, cx - r, cy, r * 2, r * 2, 0, 180);
}
}
return bmp;
}
public static Bitmap CreateLinkIcon(int size)
{
var bmp = new Bitmap(size, size);
using (Graphics g = Graphics.FromImage(bmp))
{
g.SmoothingMode = SmoothingMode.AntiAlias;
using (Brush bg = new SolidBrush(Color.FromArgb(60, 120, 200)))
g.FillEllipse(bg, 2, 2, size - 4, size - 4);
using (Pen p = new Pen(Color.White, 2.5f))
{
int m = size / 4;
int cx = size / 2;
g.DrawLine(p, m, size - m, cx, m);
g.DrawLine(p, cx, m, size - m, size - m);
g.DrawEllipse(p, m - 3, size - m - 3, 8, 8);
g.DrawEllipse(p, size - m - 5, size - m - 3, 8, 8);
}
}
return bmp;
}
public static Bitmap CreateTixIcon(int size)
{
var bmp = new Bitmap(size, size);
using (Graphics g = Graphics.FromImage(bmp))
{
g.SmoothingMode = SmoothingMode.AntiAlias;
using (Brush bg = new SolidBrush(Color.FromArgb(220, 180, 40)))
g.FillEllipse(bg, 2, 2, size - 4, size - 4);
using (Font font = new Font("Segoe UI", size * 0.4f, FontStyle.Bold))
{
StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Center;
sf.LineAlignment = StringAlignment.Center;
using (Brush tb = new SolidBrush(Color.White))
g.DrawString("T", font, tb, new Rectangle(0, 0, size, size), sf);
}
}
return bmp;
}
public static Bitmap CreateSettingsIcon(int size)
{
var bmp = new Bitmap(size, size);
using (Graphics g = Graphics.FromImage(bmp))
{
g.SmoothingMode = SmoothingMode.AntiAlias;
using (Brush bg = new SolidBrush(Color.FromArgb(100, 100, 120)))
g.FillEllipse(bg, 2, 2, size - 4, size - 4);
using (Pen p = new Pen(Color.White, 2))
{
int cx = size / 2, cy = size / 2;
g.DrawEllipse(p, cx - 6, cy - 6, 12, 12);
g.DrawLine(p, cx - 12, cy, cx - 6, cy);
g.DrawLine(p, cx + 6, cy, cx + 12, cy);
g.DrawLine(p, cx, cy - 12, cx, cy - 6);
g.DrawLine(p, cx, cy + 6, cx, cy + 12);
}
}
return bmp;
}
public static Bitmap CreateUserIcon(int size)
{
return CreateIcon(size, Color.FromArgb(70, 130, 200), "U", Color.White);
}
public static Bitmap CreateRobloxIcon(int size)
{
var bmp = new Bitmap(size, size);
using (Graphics g = Graphics.FromImage(bmp))
{
g.SmoothingMode = SmoothingMode.AntiAlias;
using (Brush bg = new SolidBrush(Color.FromArgb(200, 50, 50)))
g.FillRectangle(bg, 0, 0, size, size);
using (Font font = new Font("Segoe UI", size * 0.3f, FontStyle.Bold))
{
StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Center;
sf.LineAlignment = StringAlignment.Center;
using (Brush tb = new SolidBrush(Color.White))
g.DrawString("R", font, tb, new Rectangle(0, 0, size, size), sf);
}
}
return bmp;
}
}