예제 #1
0
        internal static XImage FromImportedImage(ImportedImage image)
        {
            if (image == null)
            {
                throw new ArgumentNullException("image");
            }

            return(new XImage(image));
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XImage"/> class from an image read by ImageImporter.
        /// </summary>
        /// <param name="image">The image.</param>
        /// <exception cref="System.ArgumentNullException">image</exception>
        XImage(ImportedImage image)
        {
            if (image == null)
            {
                throw new ArgumentNullException("image");
            }

            _importedImage = image;
            Initialize();
        }
예제 #3
0
        /// <summary>
        /// Creates an image from the specified stream.<br/>
        /// Silverlight supports PNG and JPEF only.
        /// </summary>
        /// <param name="stream">The stream containing a BMP, PNG, GIF, JPEG, TIFF, or PDF file.</param>
        /// <param name="platformIndependent">Uses an platform-independent implementation if set to true.
        /// The platform-dependent implementation, if available, will support more image formats.</param>
        /// <param name="document">The document used to obtain the options.</param>
        internal static XImage FromStream(Stream stream, bool platformIndependent, PdfDocument document)
        {
            if (!platformIndependent)
            {
                return(FromStream(stream));
            }

            // TODO: Check PDF file.

            ImageImporter ii = ImageImporter.GetImageImporter();
            ImportedImage i  = ii.ImportImage(stream, document);

            if (i == null)
            {
                throw new InvalidOperationException("Unsupported image format.");
            }

            XImage image = new XImage(i);

            image._stream = stream;
            return(image);
        }
예제 #4
0
파일: XImage.cs 프로젝트: Sl0vi/PDFsharp
        internal static XImage FromImportedImage(ImportedImage image)
        {
            if (image == null)
                throw new ArgumentNullException("image");

            return new XImage(image);
        }
예제 #5
0
파일: XImage.cs 프로젝트: Sl0vi/PDFsharp
        /// <summary>
        /// Initializes a new instance of the <see cref="XImage"/> class from an image read by ImageImporter.
        /// </summary>
        /// <param name="image">The image.</param>
        /// <exception cref="System.ArgumentNullException">image</exception>
        XImage(ImportedImage image)
        {
            if (image == null)
                throw new ArgumentNullException("image");

            _importedImage = image;
            Initialize();
        }