Exemplo n.º 1
0
        public void WritePng(IntPtr data, int width, int height, string output)
        {
            try
            {
                _stream = new FileStream(output, FileMode.Create, FileAccess.Write);

                STBImageWrite.stbi_write_png_to_func(WriteCallback, null, width, height, 4, (void *)data,
                                                     width * 4);
            }
            finally
            {
                _stream = null;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Writes JPG File
        /// </summary>
        /// <param name="image"></param>
        /// <param name="dest"></param>
        /// <param name="quality">Should be beetween 1 & 100</param>
        public void WriteJpg(Pixmap image, int quality, string output)
        {
            try
            {
                _stream = new FileStream(output, FileMode.Create, FileAccess.Write);

                fixed(byte *b = &image.PixelData[0])
                {
                    STBImageWrite.stbi_write_jpg_to_func(WriteCallback, null, image.Width, image.Height, 4, b, quality);
                }
            }
            finally
            {
                _stream = null;
            }
        }