Ejemplo n.º 1
0
            public void ShouldReturnTheValueAsString()
            {
                var value = new ExifShort(ExifTag.GPSDifferential);

                value.Value = 42;

                Assert.Equal("42", value.ToString());
            }
Ejemplo n.º 2
0
            public void Process(TiffEncoderCore encoder)
            {
                var planarConfig = new ExifShort(ExifTagValue.PlanarConfiguration)
                {
                    Value = (ushort)TiffPlanarConfiguration.Chunky
                };

                var samplesPerPixel = new ExifLong(ExifTagValue.SamplesPerPixel)
                {
                    Value = GetSamplesPerPixel(encoder)
                };

                ushort[] bitsPerSampleValue = GetBitsPerSampleValue(encoder);
                var      bitPerSample       = new ExifShortArray(ExifTagValue.BitsPerSample)
                {
                    Value = bitsPerSampleValue
                };

                ushort compressionType = GetCompressionType(encoder);
                var    compression     = new ExifShort(ExifTagValue.Compression)
                {
                    Value = compressionType
                };

                var photometricInterpretation = new ExifShort(ExifTagValue.PhotometricInterpretation)
                {
                    Value = (ushort)encoder.PhotometricInterpretation
                };

                this.Collector.AddOrReplace(planarConfig);
                this.Collector.AddOrReplace(samplesPerPixel);
                this.Collector.AddOrReplace(bitPerSample);
                this.Collector.AddOrReplace(compression);
                this.Collector.AddOrReplace(photometricInterpretation);

                if (encoder.HorizontalPredictor == TiffPredictor.Horizontal)
                {
                    if (encoder.PhotometricInterpretation == TiffPhotometricInterpretation.Rgb ||
                        encoder.PhotometricInterpretation == TiffPhotometricInterpretation.PaletteColor ||
                        encoder.PhotometricInterpretation == TiffPhotometricInterpretation.BlackIsZero)
                    {
                        var predictor = new ExifShort(ExifTagValue.Predictor)
                        {
                            Value = (ushort)TiffPredictor.Horizontal
                        };

                        this.Collector.AddOrReplace(predictor);
                    }
                }
            }
Ejemplo n.º 3
0
 /// <summary>
 /// Gets a new <see cref="ExifShort"/> instance for the <see cref="ExifTag.TileByteCounts"/> tag.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <returns>A new <see cref="ExifShort"/> instance.</returns>
 public static ExifShort TileByteCounts(ushort value) => ExifShort.Create(ExifTag.TileByteCounts, value);
Ejemplo n.º 4
0
 /// <summary>
 /// Gets a new <see cref="ExifShort"/> instance for the <see cref="ExifTag.ImageLayer"/> tag.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <returns>A new <see cref="ExifShort"/> instance.</returns>
 public static ExifShort ImageLayer(ushort value) => ExifShort.Create(ExifTag.ImageLayer, value);
Ejemplo n.º 5
0
 /// <summary>
 /// Gets a new <see cref="ExifShort"/> instance for the <see cref="ExifTag.StripOffsets"/> tag.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <returns>A new <see cref="ExifShort"/> instance.</returns>
 public static ExifShort StripOffsets(ushort value) => ExifShort.Create(ExifTag.StripOffsets, value);