[函數名稱]
圖像水準鏡像函數MirrorXProcess(WriteableBitmap
src)

[函數代碼]
///<summary>
///
Horizontal mirror process.
///</summary>
///<param
name="src">Source image.</param>
///<returns></returns>
publicstaticWriteableBitmap
MirrorXProcess(WriteableBitmap src)////19水準鏡像
{
if(src!=null
)
{
int
w = src.PixelWidth;
h = src.PixelHeight;
WriteableBitmap
mirrorImage =newWriteableBitmap(w,h);
byte[]
temp = src.PixelBuffer.ToArray();
tempMask =newbyte[w
* h * 4];
for
(int j = 0; j < h; j++)
for
(int i = 0; i < w; i++)
{
tempMask[i * 4 + j * w * 4] = temp[(w - 1 - i) * 4 + j * w * 4];
tempMask[i * 4 + 1 + j * w * 4] = temp[(w - 1 - i) * 4 + 1 + j * w *
4];
tempMask[i * 4 + 2 + j * w * 4] = temp[(w - 1 - i) * 4 + 2 + j * w *
tempMask[i * 4 + 3 + j * w * 4] = temp[(w - 1 - i) * 4 + 3 + j * w *
}
}
Stream
sTemp = mirrorImage.PixelBuffer.AsStream();
sTemp.Seek(0,
SeekOrigin.Begin);
sTemp.Write(tempMask, 0, w * 4 * h);
return
mirrorImage;
else
returnnull;
}
}
[圖像效果]