private static unsafe void TransferDataFormat8bppIndexed(BitmapData imgData, PixData pixData)
        {
            var height = imgData.Height;
            var width  = imgData.Width;

            for (var y = 0; y < height; y++)
            {
                var imgLine = (byte *)imgData.Scan0 + (y * imgData.Stride);
                var pixLine = (uint *)pixData.Data + (y * pixData.WordsPerLine);

                for (var x = 0; x < width; x++)
                {
                    var pixelVal = *(imgLine + x);
                    PixData.SetDataByte(pixLine, x, pixelVal);
                }
            }
        }
Example #2
0
        private unsafe void TransferDataFormat1bppIndexed(BitmapData imgData, PixData pixData)
        {
            var height = imgData.Height;
            var width  = imgData.Width / 8;

            for (int y = 0; y < height; y++)
            {
                byte *imgLine = (byte *)imgData.Scan0 + (y * imgData.Stride);
                uint *pixLine = (uint *)pixData.Data + (y * pixData.WordsPerLine);

                for (int x = 0; x < width; x++)
                {
                    byte pixelVal = BitmapHelper.GetDataByte(imgLine, x);
                    PixData.SetDataByte(pixLine, x, pixelVal);
                }
            }
        }