ImageMagick.MagickMemory.WriteBytes C# (CSharp) Метод

WriteBytes() публичный статический Метод

public static WriteBytes ( IntPtr value, UIntPtr length, Stream stream ) : void
value System.IntPtr
length System.UIntPtr
stream Stream
Результат void
    public static void WriteBytes(IntPtr value, UIntPtr length, Stream stream)
    {
      if (value == IntPtr.Zero)
        return;

      try
      {
        Write(value, (int)length, stream);
      }
      finally
      {
        Relinquish(value);
      }
    }
  }

Usage Example

Пример #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();
            }
        }