/// <summary>
/// Draw avatar of crystal effects
/// </summary>
/// <param name="containsPage"></param>
/// <param name="w"></param>
/// <param name="h"></param>
/// <param name="MemoString"></param>
public static void Avatar(Page containsPage, string filename, int r, int m, int s, int x, int y, bool save, string new_avatar)
{
imageSrc = (("/") + filename);
int w = ;
int h = ;
if (r == 1 || r == 3)
{
h = ;
w = ;
}
if (save)
{
w = h = 90;
}
if (w > 300) w = 300;
if (h > 300) h = 300;
Color backColor = ;
Size size = new Size(w, h);
btnbmp = new Bitmap(w, h);
Graphics g = (btnbmp);
//Reset the background color, you can customize it
();
Color clr = backColor;
= ;//Extinguish the aliasing
= .;
= .;
// Create button graphics - brush
int btnOff = 0;//Button margin
Rectangle rc1 = new Rectangle(btnOff, btnOff, - 1 - btnOff, - 1 - btnOff);
GraphicsPath gpath1 = GetGraphicsPath(rc1, 10);
GraphicsPath gpath1a = GetGraphicsPath(rc1, 15);
LinearGradientBrush br1 = new LinearGradientBrush(new Point(0, 0), new Point(0, + 6), clr, );
// Create button shadow - brush
int shadowOff = 1;//Shadow margin
Rectangle rc2 = rc1;
(0, shadowOff);
GraphicsPath gpath2 = GetGraphicsPath(rc2, 10);
PathGradientBrush br2 = new PathGradientBrush(gpath2);
= (0, 0, 0); // ;
= new Color[] { (64, 64, 64, 64), (64, 128, 128, 128) }; //
// For more realistic, we set the gradient end color to the foreground color of the form, which can be adjusted appropriately according to the foreground color of the window
// Create a white gradient on top of the button - brush
Rectangle rc3 = rc1;
(-1, -1);
= 15;
GraphicsPath gpath3 = GetGraphicsPath(rc3, 10);
LinearGradientBrush br3 = new LinearGradientBrush(rc3, (255, ), (0, ), );
//Draw the graphics
//Draw shadow
if (s > 0)
{
(br2, gpath2);
}
//Draw button
if (s > 0)
{
(br1, gpath1);
}
//if (s > 0)
//{
(gpath1a, );
//}
switch (m)
{
case 1:
_currentBitmap = (Bitmap)imageSrc;
RotateFlip();
imageSrc = ()_currentBitmap;
break;
case 2:
_currentBitmap = (Bitmap)imageSrc;
RotateFlip();
imageSrc = ()_currentBitmap;
break;
default:
break;
}
switch (r)
{
case 1:
_currentBitmap = (Bitmap)imageSrc;
RotateFlip(RotateFlipType.Rotate90FlipNone);
imageSrc = ()_currentBitmap;
break;
case 2:
_currentBitmap = (Bitmap)imageSrc;
RotateFlip(RotateFlipType.Rotate180FlipNone);
imageSrc = ()_currentBitmap;
break;
case 3:
_currentBitmap = (Bitmap)imageSrc;
RotateFlip(RotateFlipType.Rotate270FlipNone);
imageSrc = ()_currentBitmap;
break;
default:
break;
}
(imageSrc, -x, -y);
//Draw the top white bubbles
if (s > 0)
{
(br3, gpath3);
}
();
();
MemoryStream stream = new MemoryStream();
(stream, );
if (save)
{
try
{
//Save this original image in the specified format and use the specified codec parameters to the specified file
string sFile = ("/") + new_avatar;
(sFile);
}
catch ( e)
{
throw e;
}
}
//Output picture containsPage
= 0;
= (-1);
("pragma", "no-cache");
("cache-control", "private");
= "no-cache";
();
= "image/png";
(());
}