2011-10-07 9 views
2

업데이트 : BitmapData의 Windows Phone 7.1에 대한 대안을 찾아 보았습니다. 문제의 코드를 주석 처리했습니다. 나는 Lockbits에 대해 알고 있으며, 비교할 때 픽셀이 너무 빠르다는 것을 알고있다. 필자의 이해에 따라 BitmapData는 이미지를 조작 할 수 있도록 메모리에 잠급니다. BmpData.Scan0은 메모리에 대한 포인터 역할을합니다.BitmapData 및 Marshal.Copy? Windows phone의 대안은 무엇입니까?

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

도움을 주시면 감사하겠습니다. 감사합니다.

+0

이미지를 복제하고 이미지를 조작하는 것이 무엇을 하려는지 명확하지 않은가요? 양자 모두? –

+0

예 이미지를 복제 한 다음 조작하려고합니다. 조금 더 명확하게 밝히면 더 많은 코드를 소개합니다. – user970355

답변

2

WriteableBitmapEx을 살펴보십시오. 이렇게하면 이미지 내에서 픽셀 조작을 수행 할 수 있습니다.

+0

위의 시나리오에서 이것이 유용 할 수있는 방법에 대해 좀 더 자세히 설명 할 수 있습니까? 나는 [leadtools] (http://www.leadtools.com/Help/Leadtools/v175/DH/co/leadtools.codecs~leadtools.codecs.rastercodecs.html)와 다른 것들을 보았습니다. BitmapData 또는 Bitlocks와 비슷한 것은 무엇입니까? – user970355