2

更新: BitmapData 用の Windows Phone 7.1 の代替手段を見つけようと探し回っています。問題のコードをコメントアウトしました。私はロックビットを認識しており、設定されたピクセルなどを取得するのに比べて高速であることを認識しています。私の理解によると、BitmapData は操作の準備ができているメモリにイメージをロックします。BmpData.Scan0 はメモリへのポインタとして機能します。

BitmapData を使用せずにこれを行う場合は、Get.Pixel と言ってメモリにマップします。Set.Pixel で画像データの一部を操作しますか?

PS: 処理速度に関して; 多くのピクセルを変更するつもりはありません。

  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;
   }

どんな助けでも感謝します。ありがとう

4

1 に答える 1

1

WriteableBitmapExを見てください。これにより、画像内でピクセル操作を行うことができます。

于 2011-10-07T15:23:52.893 に答える