2

UPDATED: Been looking around and trying to figure out what alternative there is for windows phone 7.1 for BitmapData. I have Commented out the code in question. I am aware of Lockbits and that its fast in comparison to get set pixels and so on. As per my understanding, BitmapData Locks the image to memory ready for manipulation. BmpData.Scan0 acts as a pointer to the memory.

If I were to do this without BitmapData, say Get.Pixel and map it to memory. and manipulate some of image data with Set.Pixel?

P.S: In regards to processing speed; I am not looking to change alot of pixels.

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

Any help appreciated. Thanks

user970355
  • 31
  • 5

1 Answers1

1

Have a look at WriteableBitmapEx. This will allow you to do pixel manipulation within an image.

Matt Lacey
  • 65,560
  • 11
  • 91
  • 143
  • Can you explain a little more detail as to how this can useful in the above scenario? I have looked at [leadtools](http://www.leadtools.com/Help/Leadtools/v175/DH/co/leadtools.codecs~leadtools.codecs.rastercodecs.html) and some others. Anything similar to BitmapData or Bitlocks? – user970355 Oct 07 '11 at 16:26