BitMiracle.LibTiff.Classic.TiffRgbaImage.putRGBAAcontig8bittile C# (CSharp) Method

putRGBAAcontig8bittile() private static method

8-bit packed samples => RGBA w/ associated alpha (known to have Map == null)
private static putRGBAAcontig8bittile ( TiffRgbaImage img, int raster, int rasterOffset, int rasterShift, int x, int y, int width, int height, byte buffer, int offset, int bufferShift ) : void
img TiffRgbaImage
raster int
rasterOffset int
rasterShift int
x int
y int
width int
height int
buffer byte
offset int
bufferShift int
return void
        private static void putRGBAAcontig8bittile(
            TiffRgbaImage img, int[] raster, int rasterOffset, int rasterShift,
            int x, int y, int width, int height, byte[] buffer, int offset, int bufferShift)
        {
            int samplesperpixel = img.samplesperpixel;
            bufferShift *= samplesperpixel;

            while (height-- > 0)
            {
                int _x;
                for (_x = width; _x >= 8; _x -= 8)
                {
                    for (int rc = 0; rc < 8; rc++)
                    {
                        raster[rasterOffset] = PACK4(buffer[offset], buffer[offset + 1], buffer[offset + 2], buffer[offset + 3]);
                        rasterOffset++;
                        offset += samplesperpixel;
                    }
                }

                if (_x > 0)
                {
                    if (_x <= 7 && _x > 0)
                    {
                        for (int i = _x; i > 0; i--)
                        {
                            raster[rasterOffset] = PACK4(buffer[offset], buffer[offset + 1], buffer[offset + 2], buffer[offset + 3]);
                            rasterOffset++;
                            offset += samplesperpixel;
                        }
                    }
                }

                rasterOffset += rasterShift;
                offset += bufferShift;
            }
        }