c# - 位图数据和 Marshal.Copy? Windows Phone 有什么替代品?

标签 c# windows-phone-7 windows-phone-7.1 getpixel lockbits

更新: 一直在环顾四周,并试图找出 BitmapData 的 Windows Phone 7.1 的替代方案。我已经注释掉了有问题的代码。我知道 Lockbits 并且与设置像素等相比它的速度很快。 据我了解, BitmapData 将图像锁定到内存中以备操作。 BmpData.Scan0 充当指向内存的指针。

如果我在没有 BitmapData 的情况下执行此操作,请说 Get.Pixel 并将其映射到内存。并使用 Set.Pixel 处理一些图像数据?

P.S:关于处理速度;我不想改变很多像素。

  public int Edit(Bitmap BmpIn, byte[] BIn, byte BitsPerByte)
  {
      int LengthBytes = 1 + 31 / BitsPerByte;
      int TextLength = 1 + (8 * BIn.Length - 1) / BitsPerByte;
      //BitmapData BmpData = BmpIn.LockBits(new Rectangle(0, 0, BmpIn.Width, BmpIn.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
      RGB = new byte[2 + LengthBytes + TextLength];
      //Marshal.Copy(BmpData.Scan0, RGB, 0, RGB.Length);
      InsertBitsPerByte(BitsPerByte);
      SetMasks(BitsPerByte);
      InsertLength(LengthBytes, TextLength, BitsPerByte);
      InsertBytes(BIn, BitsPerByte);
      //Marshal.Copy(RGB, 0, BmpData.Scan0, RGB.Length);
      BmpIn.UnlockBits(BmpData);
      return TextLength;
   }

感谢任何帮助。 谢谢

最佳答案

看看WriteableBitmapEx .这将允许您在图像中进行像素操作。

关于c# - 位图数据和 Marshal.Copy? Windows Phone 有什么替代品?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7689273/

相关文章:

c# - Windows Phone 7 - 使用 WebClient 处理 Application_UnhandledException 中的错误

windows-phone-7 - 更改 PivotItem 标题模板?

c# - 如何通过 nuget 为 Windows Phone 7.1 和 Silverlight v.4,0 正确安装 Json.net

c# - 解密加密文本

c# - 来自 App.xaml.cs 的 wp7 刷新页面

windows-phone-7 - 如何从返回堆栈中删除除当前页面之外的所有历史记录?

audio - 检测麦克风/耳机?

c# - 为什么这个转换不起作用?

c# - int.TryParse() 为 "#.##"返回 false

c# - 如何使用 selenium webdriver 将鼠标悬停在不执行任何鼠标单击的情况下查看隐藏菜单?