WriteableBitmap has protected content. Pixel access is not allowed.
WriteableBitmap bitmap; //screenGrab is the Image screenGrab.Source = null; var aboutTheShowPage = ((App)Application.Current).RootVisual as Grid; var aboutTheShowMainPage = aboutTheShowPage.Children[0] as MainPage; var wShowListSubMenuExaboutTheShowPage = aboutTheShowMainPage.viewbox.Child as WShowListSubMenuEx; this.bitmap = new WriteableBitmap((int)wShowListSubMenuExaboutTheShowPage.ActualWidth, (int)wShowListSubMenuExaboutTheShowPage.ActualHeight); bitmap.Render(wShowListSubMenuExaboutTheShowPage, this.transform); bitmap.Invalidate(); // set the source of our transition image to the WriteableBitmap this.screenGrab.Source = bitmap; long matrixSize = bitmap.PixelWidth * bitmap.PixelHeight; long byteSize = matrixSize * 4 + 4; byte[] retVal = new byte[byteSize]; long bufferPos = 0; retVal[bufferPos++] = (byte)((bitmap.PixelWidth / 256) & 0xff); retVal[bufferPos++] = (byte)((bitmap.PixelWidth % 256) & 0xff); retVal[bufferPos++] = (byte)((bitmap.PixelHeight / 256) & 0xff); retVal[bufferPos++] = (byte)((bitmap.PixelHeight % 256) & 0xff); for (int matrixPos = 0; matrixPos < matrixSize; matrixPos++) { retVal[bufferPos++] = (byte)((bitmap.Pixels[matrixPos] >> 24) & 0xff); retVal[bufferPos++] = (byte)((bitmap.Pixels[matrixPos] >> 16) & 0xff); retVal[bufferPos++] = (byte)((bitmap.Pixels[matrixPos] >> 8) & 0xff); retVal[bufferPos++] = (byte)((bitmap.Pixels[matrixPos]) & 0xff); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)