今天来分享一下在GIS上加载深色的底图效果;
1、二维GIS下的效果:
2、三维GIS下的效果:
3、参考链接:
https://www.cnblogs.com/m7777/p/16280817.html
4、实现的图片转换效果:
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的冷静、编码的激情、完成后的喜悦、挖坑的激动 、填坑的兴奋;这也许就是屌丝程序员的乐趣吧;今天就到这里吧;希望自己有动力一步一步坚持下去;生命不息,代码不止;大家抽空可以看看今天分享的效果,有好的意见和想法,可以在留言板随意留言;我看到后会第一时间回复大家,多谢大家的一直默默的关注和支持!如果觉得不错,那就伸出您的小手点个赞并关注一下,多谢您的支持!