当前位置: 首页 > news >正文

丰浩网站建设中心什么是商务网站

丰浩网站建设中心,什么是商务网站,招聘求职网站html模板,建设行业门户网站此示例产生了一些令人印象深刻的结果#xff0c;但实际上非常简单。 它使用其他几个示例演示的 ImageAttribute 技术来快速操作图像的颜色。 下面的AdjustColor方法启动图像着色的过程。 // Adjust the images colors. private Image AdjustColor(Image image) {// Make the … 此示例产生了一些令人印象深刻的结果但实际上非常简单。 它使用其他几个示例演示的 ImageAttribute 技术来快速操作图像的颜色。 下面的AdjustColor方法启动图像着色的过程。 // Adjust the images colors. private Image AdjustColor(Image image) {// Make the ColorMatrix.ColorMatrix cm GetColorMatrix();ImageAttributes attributes new ImageAttributes();attributes.SetColorMatrix(cm);// Make the result image.return image.CopyImage(attributes); } 此方法调用稍后描述的GetColorMatrix方法来获取一个ColorMatrix对象该对象保存您在文本框中输入的值。然后它创建一个ImageAttribute对象并使用其SetColorMatrix方法将ColorMatrix存储在ImageAttribute对象中。最后它调用CopyImage扩展方法稍后描述将颜色矩阵应用于图像并返回结果。 以下代码显示GetColorMatrix方法。 // Return the matrix entered by the user. private ColorMatrix GetColorMatrix() {float[][] values GetMatrix();if (values null) return null;return new ColorMatrix(values); } GetColorMatrix 方法调用GetMatrix方法来获取一个float[][]其中包含您在程序的文本框中输入的值。以下代码显示GetMatrix方法。 private float[][] GetMatrix() {float[][] values new float[][]{new float[5],new float[5],new float[5],new float[5],new float[5],};for (int i 0; i 5; i){for (int j 0; j 5; j){float value;if (!float.TryParse(TextBoxes[i][j].Text, out value)){MessageBox.Show(Invalid entry);TextBoxes[i][j].Focus();return null;}values[i][j] value;}}return values; } 此方法创建一个float[][] 然后通过循环遍历TextBoxes数组的行和列来填充它该数组保存对程序的TextBox控件的引用。 以下代码显示程序如何初始化TextBoxes数组。 private TextBox[][] TextBoxes;// Display the image converted to sepia tone. private void Form1_Load(object sender, EventArgs e) {TextBoxes new TextBox[][]{new TextBox[] {txt00, txt01, txt02, txt03, txt04},new TextBox[] {txt10, txt11, txt12, txt13, txt14},new TextBox[] {txt20, txt21, txt22, txt23, txt24},new TextBox[] {txt30, txt31, txt32, txt33, txt34},new TextBox[] {txt40, txt41, txt42, txt43, txt44},}; } 程序在类级别声明了TextBoxes数组。其Form_Load事件处理程序初始化该数组。 快速回顾一下GetColorMatrix调用GetMatrix来获取您输入的浮点值并使用该数组创建和返回ColorMatrix对象。GetMatrix方法循环遍历TextBoxes数组以填充它返回的数组。 复制图像 .NET Image类提供了几种创建图像副本的方法。最省事的方法是调用其Clone方法。不幸的是该方法返回一个通用oobject 因此如果您想将其用作Image则需要将其转换为Image。 复制图像是我经常做的事情所以我决定创建以下两种扩展方法来使其更容易。 public static class Extensions {public static Image CopyImage(this Image image){return (Image)image.Clone();}public static Image CopyImage(this Image image, ImageAttributes attributes){Bitmap result new Bitmap(image.Width, image.Height);using (Graphics gr Graphics.FromImage(result)){Rectangle rect new Rectangle(0, 0, image.Width, image.Height);gr.DrawImage(image, rect,0, 0, image.Width, image.Height,GraphicsUnit.Pixel, attributes);}return result;} } 第一个方法克隆图像将结果重新转换为Image并返回结果。您可以像以下代码一样使用它。 Image copy_of_image original_image.CopyImage(); 第二种方法复制图像同时将ImageAttributes对象应用于该图像。这就是本示例为图像着色的方式。 第二种方法创建一个与原始图像大小相同的新Bitmap对象并创建一个关联的Graphics对象。它创建一个大小适合图像的Rectangle 然后调用Graphics对象的DrawImage方法将图像绘制到新的Bitmap上。这就是我想要制作扩展方法的原因之一。将图像绘制到另一幅图像上的方法很不方便。使用这种方法我不必费心创建一个Rectangle并将坐标、宽度和高度传递给DrawImage方法。 前面显示的AdjustColor 方法在以下语句中 使用了CopyImage的第二个版本。 // Make the result image. return image.CopyImage(attributes); 示例程序还包括其他一些细节例如打开和保存文件的代码以及填充特定颜色例如红色、绿色、棕褐色等矩阵值的菜单项。文章顶部的图片显示了转换为棕褐色调的图像。 完整源码https://download.csdn.net/download/ljygood2/90104001
http://www.pierceye.com/news/82672/

相关文章:

  • 嘉兴响应式网站海兴县建设工程招标信息网站
  • 网站开发投标文件手机 字体 wordpress
  • 网站域名信息查询免费视频素材软件app
  • 如何清空网站数据库电脑什么软件做短视频网站
  • 山东咕果做网站怎么样工业设计公司有哪些
  • 做电商网站前端需要什么框架互站网
  • 自己建设网站引流微信手机官方网站首页
  • 岳阳设计网站推荐郑州小程序网站开发
  • 济南小程序网站制作关键词百度云
  • 深圳html5网站开发域名备案需要多少时间
  • 企业网站制作流程如何自己做企业网站
  • 奖励网站源码昆山网站建设哪家便宜
  • 杭州网站优化培训做网站有限公司
  • 江苏网站建设网站排名优化网络安全培训机构排名
  • 河北特定网站建设推荐h5怎么制作下一页
  • 网络优化seo薪酬semseo名词解释
  • asp.net网站开发与项目实战为网站制定一个推广计划
  • 做好网站优化的方法有哪些?厦门住房和城乡建设局网站
  • 鹰潭门户网站建设费用如何降低网站跳出率
  • wordpress导航栏下拉菜单代码网站搜索引擎优化怎么做
  • 厦门市建设协会网站wordpress cron
  • 建筑资质查询官方网站html免费模板网站
  • 沧州市做网站做翻译 网站吗
  • 鲜花网站数据库建设分析做网站需要有服务器
  • 网站建设邮箱免费自助建站wordpress建立商城
  • html网站开发心得体会app推广员是做什么的
  • 企业品牌网站建设方案域名价格查询评估
  • 2019做seo网站wordpress 空间推荐
  • 自己做的表白网站网站建设可行性研究报告范文
  • 做内贸哪个网站找客户seo技术培训江门