Пример #1
0
 protected override IFDEntry ParseIFDEntry(ushort tag, ushort type, uint count, long base_offset, uint offset)
 {
     if (tag == 0x002e && !seen_jpgfromraw)
     {
         file.Seek(base_offset + offset, SeekOrigin.Begin);
         var data       = file.ReadBlock((int)count);
         var mem_stream = new MemoryStream(data.Data);
         var res        = new StreamJPGAbstraction(mem_stream);
         (file as Rw2.File).JpgFromRaw = new Jpeg.File(res, ReadStyle.Average);
         seen_jpgfromraw = true;
         return(null);
     }
     return(base.ParseIFDEntry(tag, type, count, base_offset, offset));
 }
Пример #2
0
		/// <summary>
		///    Try to parse the given IFD entry, used to discover format-specific entries.
		/// </summary>
		/// <param name="tag">
		///    A <see cref="System.UInt16"/> with the tag of the entry.
		/// </param>
		/// <param name="type">
		///    A <see cref="System.UInt16"/> with the type of the entry.
		/// </param>
		/// <param name="count">
		///    A <see cref="System.UInt32"/> with the data count of the entry.
		/// </param>
		/// <param name="base_offset">
		///    A <see cref="System.Int64"/> with the base offset which every offsets in the
		///    IFD are relative to.
		/// </param>
		/// <param name="offset">
		///    A <see cref="System.UInt32"/> with the offset of the entry.
		/// </param>
		/// <returns>
		///    A <see cref="IFDEntry"/> with the given parameters, or null if none was parsed, after
		///    which the normal TIFF parsing is used.
		/// </returns>
		protected override IFDEntry ParseIFDEntry (ushort tag, ushort type, uint count, long base_offset, uint offset) {
			if (tag == 0x002e && !seen_jpgfromraw) {
				// FIXME: JpgFromRaw

				file.Seek (base_offset + offset, SeekOrigin.Begin);
				var data = file.ReadBlock ((int) count);
				var mem_stream = new MemoryStream (data.Data);
				var res = new StreamJPGAbstraction (mem_stream);
				(file as Rw2.File).JpgFromRaw = new Jpeg.File (res, ReadStyle.Average);

				seen_jpgfromraw = true;
				return null;
			}

			return base.ParseIFDEntry (tag, type, count, base_offset, offset);
		}