Ejemplo n.º 1
0
        internal override ImageData PrepareImageData()
        {
            ImagePrivateDataDct data      = (ImagePrivateDataDct)Data;
            ImageDataDct        imageData = new ImageDataDct();

            imageData.Data   = data.Data;
            imageData.Length = data.Length;

            return(imageData);
        }
Ejemplo n.º 2
0
        // TODO Find information about JPEG2000.

        // Notes: JFIF is big-endian.

        public ImportedImage ImportImage(StreamReaderHelper stream, PdfDocument document)
        {
            try
            {
                stream.CurrentOffset = 0;
                // Test 2 magic bytes.
                if (TestFileHeader(stream))
                {
                    // Skip over 2 magic bytes.
                    stream.CurrentOffset += 2;

                    ImagePrivateDataDct ipd = new ImagePrivateDataDct(stream.Data, stream.Length);
                    ImportedImage       ii  = new ImportedImageJpeg(this, ipd, document);
                    if (TestJfifHeader(stream, ii))
                    {
                        bool colorHeader = false, infoHeader = false;

                        while (MoveToNextHeader(stream))
                        {
                            if (TestColorFormatHeader(stream, ii))
                            {
                                colorHeader = true;
                            }
                            else if (TestInfoHeader(stream, ii))
                            {
                                infoHeader = true;
                            }
                        }
                        if (colorHeader && infoHeader)
                        {
                            return(ii);
                        }
                    }
                }
            }
            // ReSharper disable once EmptyGeneralCatchClause
            catch (Exception)
            {
            }
            return(null);
        }
Ejemplo n.º 3
0
        // TODO Find information about JPEG2000.

        // Notes: JFIF is big-endian.

        public ImportedImage ImportImage(StreamReaderHelper stream, PdfDocument document)
        {
            try
            {

                stream.CurrentOffset = 0;
                // Test 2 magic bytes.
                if (TestFileHeader(stream))
                {
                    // Skip over 2 magic bytes.
                    stream.CurrentOffset += 2;

                    ImagePrivateDataDct ipd = new ImagePrivateDataDct(stream.Data, stream.Length);
                    ImportedImage ii = new ImportedImageJpeg(this, ipd, document);
                    if (TestJfifHeader(stream, ii))
                    {
                        bool colorHeader = false, infoHeader = false;

                        while (MoveToNextHeader(stream))
                        {
                            if (TestColorFormatHeader(stream, ii))
                            {
                                colorHeader = true;
                            }
                            else if (TestInfoHeader(stream, ii))
                            {
                                infoHeader = true;
                            }
                        }
                        if (colorHeader && infoHeader)
                            return ii;
                    }
                }
            }
            // ReSharper disable once EmptyGeneralCatchClause
            catch (Exception)
            {
            }
            return null;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ImportedImageJpeg"/> class.
 /// </summary>
 public ImportedImageJpeg(IImageImporter importer, ImagePrivateDataDct data, PdfDocument document)
     : base(importer, data, document)
 { }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ImportedImageJpeg"/> class.
 /// </summary>
 public ImportedImageJpeg(IImageImporter importer, ImagePrivateDataDct data, PdfDocument document)
     : base(importer, data, document)
 {
 }