博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
处理图片透明操作
阅读量:4565 次
发布时间:2019-06-08

本文共 963 字,大约阅读时间需要 3 分钟。

//   /// 处理图片透明操作  ///   /// 原始图片  /// 透明度(0.0---1.0)  /// 
private Image TransparentImage(Image srcImage, float opacity) { float[][] nArray ={ new float[] {1, 0, 0, 0, 0}, new float[] {0, 1, 0, 0, 0}, new float[] {0, 0, 1, 0, 0}, new float[] {0, 0, 0, opacity, 0}, new float[] {0, 0, 0, 0, 1}}; ColorMatrix matrix = new ColorMatrix(nArray); ImageAttributes attributes = new ImageAttributes(); attributes.SetColorMatrix(matrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); Bitmap resultImage = new Bitmap(srcImage.Width, srcImage.Height); Graphics g = Graphics.FromImage(resultImage); g.DrawImage(srcImage, new Rectangle(0, 0, srcImage.Width, srcImage.Height), 0, 0, srcImage.Width, srcImage.Height, GraphicsUnit.Pixel, attributes); return resultImage; }

  

转载于:https://www.cnblogs.com/CJSTONE/p/4961835.html

你可能感兴趣的文章
CodeForces 731A Night at the Museum
查看>>
MySQL 删除数据库
查看>>
JavaScript 字符串(String) 对象
查看>>
How to use VisualSVN Server and TortoiseSVN to host your codes and control your codes' version
查看>>
微信小程序picker组件 - 省市二级联动
查看>>
Dynamics CRM 给视图配置安全角色
查看>>
Eclipse修改已存在的SVN地址
查看>>
(转)使用 python Matplotlib 库绘图
查看>>
进程/线程切换原则
查看>>
正则表达式语法
查看>>
20165301 2017-2018-2 《Java程序设计》第四周学习总结
查看>>
Vue的简单入门
查看>>
urllib 中的异常处理
查看>>
通过SQL Server的扩展事件来跟踪SQL语句在运行时,时间都消耗到哪儿了?
查看>>
20181227 新的目标
查看>>
androidtab
查看>>
php 事件驱动 消息机制 共享内存
查看>>
剑指offer 二叉树的bfs
查看>>
LeetCode Maximum Subarray
查看>>
让我们再聊聊浏览器资源加载优化
查看>>