Ejemplo n.º 1
0
        /// <summary>
        /// Create a <see cref="IWICStream"/> from given data.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="data">Data to initialize with.</param>
        /// <returns>New instance of <see cref="IWICStream"/> or throws exception.</returns>
        public IWICStream CreateStream <T>(T[] data) where T : unmanaged
        {
            IWICStream wicStream = CreateStream_();

            wicStream.Initialize(data).CheckError();
            return(wicStream);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create a <see cref="IWICStream"/> from another stream. Access rights are inherited from the underlying stream
        /// </summary>
        /// <param name="stream">The initialize stream.</param>
        /// <returns>New instance of <see cref="IWICStream"/> or throws exception.</returns>
        public IWICStream CreateStream(Stream stream)
        {
            IWICStream wicStream = CreateStream_();

            wicStream.Initialize(stream).CheckError();
            return(wicStream);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create a <see cref="IWICStream"/> from another stream. Access rights are inherited from the underlying stream
        /// </summary>
        /// <param name="comStream">The initialize stream.</param>
        /// <returns>New instance of <see cref="IWICStream"/> or throws exception.</returns>
        public IWICStream CreateStream(IStream comStream)
        {
            IWICStream stream = CreateStream_();

            stream.Initialize(comStream).CheckError();
            return(stream);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Create a <see cref="IWICStream"/> from file name.
        /// </summary>
        /// <param name="fileName">The file name.</param>
        /// <param name="access">The <see cref="FileAccess"/> mode.</param>
        /// <returns>New instance of <see cref="IWICStream"/> or throws exception.</returns>
        public IWICStream CreateStream(string fileName, FileAccess access)
        {
            IWICStream stream = CreateStream_();

            stream.Initialize(fileName, access).CheckError();
            return(stream);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Initializes the encoder with the provided stream.
        /// </summary>
        /// <param name="stream">The stream to use for initialization.</param>
        /// <param name="cacheOption">The <see cref="BitmapEncoderCacheOption"/> used on initialization.</param>
        public void Initialize(Stream stream, BitmapEncoderCacheOption cacheOption = BitmapEncoderCacheOption.NoCache)
        {
            DisposeWICStreamProxy();

            _wicStream = _factory.CreateStream(stream);
            Initialize_(_wicStream, cacheOption);
        }
Ejemplo n.º 6
0
 private void DisposeWICStreamProxy()
 {
     if (_wicStream != null)
     {
         _wicStream.Dispose();
         _wicStream = null;
     }
 }