public LinearAccessByteImageUnsignedHusk(LinearAccessByteImageUnsignedNonVectorized referenceImage)
 {
     stride              = referenceImage.stride;
     width               = referenceImage.width;
     height              = referenceImage.height;
     pixelFormat         = referenceImage.pixelFormat;
     originalPixelFormat = referenceImage.originalPixelFormat;
     originalStride      = referenceImage.originalStride;
 }
Esempio n. 2
0
        public static Bitmap ByteArrayToBitmap(LinearAccessByteImageUnsignedNonVectorized byteImage)
        {
            Bitmap    myBitmap = new Bitmap(byteImage.width, byteImage.height, byteImage.originalPixelFormat);
            Rectangle rect     = new Rectangle(0, 0, myBitmap.Width, myBitmap.Height);

            System.Drawing.Imaging.BitmapData bmpData =
                myBitmap.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite,
                                  myBitmap.PixelFormat);

            bmpData.Stride = byteImage.originalStride;

            IntPtr ptr = bmpData.Scan0;

            byte[] originalDataReconstruction = byteImage.getOriginalDataReconstruction();
            System.Runtime.InteropServices.Marshal.Copy(originalDataReconstruction, 0, ptr, originalDataReconstruction.Length);

            myBitmap.UnlockBits(bmpData);
            return(myBitmap);
        }