WriteBytes() public static method

public static WriteBytes ( IntPtr value, UIntPtr length, Stream stream ) : void
value System.IntPtr
length System.UIntPtr
stream Stream
return void
示例#1
0
        ///<summary>
        /// Writes the imagse to the specified stream. If the output image's file format does not
        /// allow multi-image files multiple files will be written.
        ///</summary>
        ///<param name="stream">The stream to write the images to.</param>
        ///<exception cref="MagickException"/>
        public void Write(Stream stream)
        {
            Throw.IfNull("stream", stream);

            if (_Images.Count == 0)
            {
                return;
            }

            MagickSettings settings = _Images[0].Settings;

            settings.FileName = null;

            try
            {
                AttachImages();

                UIntPtr length;
                IntPtr  data = _NativeInstance.WriteBlob(_Images[0], settings, out length);
                MagickMemory.WriteBytes(data, length, stream);
            }
            finally
            {
                DetachImages();
            }
        }