c#给图片增加阴影库

时间:2014-10-27 04:07:24
【文件属性】:

文件名称:c#给图片增加阴影库

文件大小:50KB

文件格式:RAR

更新时间:2014-10-27 04:07:24

c#给图片增加阴影库

c#给图片增加阴影库 // background Layer bg = image.Layers.Add(); bg.Clear(bkcolor); // shadow -- layer must be larger because of blur Layer shadow = image.Layers.Add(width + shadowwidth, height + shadowwidth); SolidBrush brush = new SolidBrush(shadowcolor); shadow.FillRectangle(shadowwidth, shadowwidth, bmp.Width, bmp.Height, brush); if (softshadow) shadow.Blur(shadowwidth, shadowwidth); brush.Dispose(); shadow.OffsetX = shadowx; shadow.OffsetY = shadowy; shadow.Opacity = 1.0 - shadowtrans; // image Layer img = image.Layers.Add(bmp); img.OffsetX = imgx; img.OffsetY = imgy; // result FastBitmap result = image.Flatten(); // save String filename = outputfile != "" ? outputfile : inputfile; String ext = Path.GetExtension(filename); if (ext == "") ext = ".bmp"; ext = ext.ToLower(); ImageFormat imgf = ImageFormat.Bmp; switch (ext) { case ".bmp": ext = ".bmp"; imgf = ImageFormat.Bmp; break; case ".jpg": ext = ".jpg"; imgf = ImageFormat.Jpeg; break; case ".jpeg": ext = ".jpeg"; imgf = ImageFormat.Jpeg; break; case ".png": ext = ".png"; imgf = ImageFormat.Png; break; case ".gif": ext = ".gif"; imgf = ImageFormat.Gif; break; default: ext = ".bmp"; imgf = ImageFormat.Bmp; break; } filename = Path.GetFileNameWithoutExtension(filename); result.Save(filename + ext, imgf);


【文件预览】:
ShadowPanel_AutoSize.rar
shadow
----shadow_src()
--------c.bat(47B)
--------shadow.cs(25KB)
--------shadow.exe(28KB)

网友评论

  • 不错~ 慢慢琢磨该怎么用
  • 代码好长,但效果不是很好