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

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

1、二维GIS下的效果:

2、三维GIS下的效果:

3、参考链接:

https://www.cnblogs.com/m7777/p/16280817.html

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

aa75ed69a67b80b6ca3beaf7920578e9.gif

5、图片转换的方法:

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值