Quantcast
Channel: WriteableBitmapEx
Viewing all articles
Browse latest Browse all 360

New Post: save PNG (transparent picture)

$
0
0
To fix the pixel shift or discoloration issue search for
               data[dataOffset + 0] = pixels[pixelOffset + 0];
                data[dataOffset + 1] = pixels[pixelOffset + 1];
                data[dataOffset + 2] = pixels[pixelOffset + 2];
                data[dataOffset + 3] = pixels[pixelOffset + 3];

                if (y > 0)
                {
                    int lastOffset = ((y - 1) * _image.PixelWidth + x) * 4;

                    data[dataOffset + 0] -= pixels[lastOffset + 0];
                    data[dataOffset + 1] -= pixels[lastOffset + 1];
                    data[dataOffset + 2] -= pixels[lastOffset + 2];
                    data[dataOffset + 3] -= pixels[lastOffset + 3];
                }
and replace with
               data[dataOffset + 0] = pixels[pixelOffset + 2];
                data[dataOffset + 1] = pixels[pixelOffset + 1];
                data[dataOffset + 2] = pixels[pixelOffset + 0];
                data[dataOffset + 3] = pixels[pixelOffset + 3];

                if (y > 0)
                {
                    int lastOffset = ((y - 1) * _image.PixelWidth + x) * 4;

                    data[dataOffset + 0] -= pixels[lastOffset + 2];
                    data[dataOffset + 1] -= pixels[lastOffset + 1];
                    data[dataOffset + 2] -= pixels[lastOffset + 0];
                    data[dataOffset + 3] -= pixels[lastOffset + 3];
                }

Viewing all articles
Browse latest Browse all 360

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>