我下载了一套VS2015图标,并通过MSDN guideVS2015图标指南 - 颜色反转
在阅读“使用图像中的颜色”,它指出,“为了使图标显示正确的对比度在Visual Studio的黑暗主题中,反转是以编程方式应用的“
我试图在我的应用程序中模仿这种行为,但是当我对图像应用颜色反转时,它不会出现它的方式看起来在VS的黑暗主题:
有谁知道VS如何反转颜色,所以我可以模仿这个?
编辑: 这是我使用的反码 - 这个问题似乎与透明度/阿尔法边缘:
public static void InvertColors(Bitmap bitmapImage)
{
var bitmapRead = bitmapImage.LockBits(new Rectangle(0, 0, bitmapImage.Width, bitmapImage.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppPArgb);
var bitmapLength = bitmapRead.Stride * bitmapRead.Height;
var bitmapBGRA = new byte[bitmapLength];
Marshal.Copy(bitmapRead.Scan0, bitmapBGRA, 0, bitmapLength);
bitmapImage.UnlockBits(bitmapRead);
for (int i = 0; i < bitmapLength; i += 4)
{
bitmapBGRA[i] = (byte)(255 - bitmapBGRA[i]);
bitmapBGRA[i + 1] = (byte)(255 - bitmapBGRA[i + 1]);
bitmapBGRA[i + 2] = (byte)(255 - bitmapBGRA[i + 2]);
}
var bitmapWrite = bitmapImage.LockBits(new Rectangle(0, 0, bitmapImage.Width, bitmapImage.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppPArgb);
Marshal.Copy(bitmapBGRA, 0, bitmapWrite.Scan0, bitmapLength);
bitmapImage.UnlockBits(bitmapWrite);
}
你能告诉我们一些代码,显示到目前为止你已经尝试了什么? Visual Studio的源代码是专有的,所以你不可能找到任何能够告诉你它在源代码方面如何工作的人。 –