前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >WPF效果第二百四十五篇加载深蓝底图效果

WPF效果第二百四十五篇加载深蓝底图效果

作者头像
WPF程序员
发布2024-07-18 14:08:27
790
发布2024-07-18 14:08:27

今天来分享一下在GIS上加载深色的底图效果;

1、二维GIS下的效果:

2、三维GIS下的效果:

3、参考链接:

代码语言:javascript
复制
https://www.cnblogs.com/m7777/p/16280817.html

4、实现的图片转换效果:

5、图片转换的方法:

代码语言:javascript
复制
  // 遍历每个像素
  for (int y = 0; y < inputBitmap.Height; y++)
  {
      for (int x = 0; x < inputBitmap.Width; x++)
      {
          Color originalColor = inputBitmap.GetPixel(x, y);
          // 灰度化
          int grayValue = (int)(originalColor.R * 0.299 + originalColor.G * 0.587 + originalColor.B * 0.114);
          Color grayColor = Color.FromArgb(grayValue, grayValue, grayValue);
          // 反转颜色
          int invertedR = 255 - grayColor.R;
          int invertedG = 255 - grayColor.G;
          int invertedB = 255 - grayColor.B;
          // 应用深蓝色调
          float blueTintFactorR = 0.2f;
          float blueTintFactorG = 0.3f;
          float blueTintFactorB = 0.5f;
          int tintedR = (int)(invertedR * blueTintFactorR);
          int tintedG = (int)(invertedG * blueTintFactorG);
          int tintedB = (int)(invertedB * blueTintFactorB);
          //调整为所需的亮度
          float brightness = 2.5f; 
          //调整为所需的对比度
          float contrast = 1f;
          int adjustedR = (int)((((tintedR / 255.0f - 0.5f) * contrast + 0.5f) * brightness) * 255);
          int adjustedG = (int)((((tintedG / 255.0f - 0.5f) * contrast + 0.5f) * brightness) * 255);
          int adjustedB = (int)((((tintedB / 255.0f - 0.5f) * contrast + 0.5f) * brightness) * 255);
          // 确保颜色在有效范围内
          adjustedR = Clamp(adjustedR, 0, 255);
          adjustedG = Clamp(adjustedG, 0, 255);
          adjustedB = Clamp(adjustedB, 0, 255);
          // 设置新颜色
          Color newColor = Color.FromArgb(adjustedR, adjustedG, adjustedB);
          outputBitmap.SetPixel(x, y, newColor);
      }
  }

编程不息、Bug不止、无Bug、无生活;改bug的冷静、编码的激情、完成后的喜悦、挖坑的激动 、填坑的兴奋;这也许就是屌丝程序员的乐趣吧;今天就到这里吧;希望自己有动力一步一步坚持下去;生命不息,代码不止;大家抽空可以看看今天分享的效果,有好的意见和想法,可以在留言板随意留言;我看到后会第一时间回复大家,多谢大家的一直默默的关注和支持!如果觉得不错,那就伸出您的小手点个赞并关注一下,多谢您的支持!

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2024-07-12,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 WPF程序员 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档