现在在 Slivrtlight客户端显示图片的时候,如何对图片颜色进行过滤呢?


------解决方案--------------------
没时间写代码调试,大概这样的方向试试看:
WriteableBitmap bitmap = this.DrawToBitmap();
for (int y = 0; y < bitmap.PixelHeight; y++)
{
for (int x = 0; x < bitmap.PixelWidth; x++)
{ //取得每一個pixel
int pixelLocation = bitmap.PixelWidth * y + x;
int pixel = bitmap.Pixels[pixelLocation];
//这里byte[4]填写为需要判断的指定RGB颜色
if(BitConverter.ToInt32(new byte[4] { 0, 0, 0, 0 }, 0) == pixel) 
bitmap.Pixels[pixelLocation] = BitConverter.ToInt32(new byte[4] { 0, 0, 0, 0 }, 0); //这里byte[4]为要替换的RGB颜色
}
}
this.m_image.Source = bitmap;

相关推荐