HTML5. A vocabulary and associated APIs for HTML and XHTML. W3C Recommendation 28 October 2014. Continuing the above example, a requirement stating that a particular attribute's value is constrained to being a valid integer emphatically does not imply anything. About Development on Two- Way RTF to XML/XHTML Converter Components and Services. Rtf. Converter. Ph. S_src > https: //sourceforge. Rtf. Converter. Ph. S_src. zip. XHTML2. Simple XML serialzation and configuration. Nested object serialization: As well as simple object serialization, nested object serialization is possible. Sys : System functions. See below for a short description. Parser : Parsing of RTF data. ParserTests: Unit tests for Parser. Interpreter : Interpretation of parsed. Support for packages has been discontinued on Sunfreeware. Please Visit our New Website - UNIXPackages.com. UNIX packages provides full package support for all levels. RTF_Ph. S > https: //sourceforge. XHTML2. RTF_Ph. S. About development of 2way. RTF2. XM_XHTML converter on CS_ASP. OVERVIEW- Part 1. Microsoft introduced the Rich Text Format for specifying simple formatted text with embedded graphics. Initially intended to transfer such data between different applications on different operating systems, today this format is commonly used in Windows for enhanced editing capabilities. The XHTML to RTF converter consists in an XSL stylesheet for parsing XHTML tags and generating their RTF equivalents. New challenges of RTF: Extraction of text without consideration of any format information; Extraction and conversion of embedded image information; Conversion of the RTF layout and/or data into another format such as XML or HTML; Transferring RTF data into a custom data model. Goals of designing the component: To developed an application which can doing conversion from RTF to Text/XML/HTMLSupport for the current RTF; Open source C#. NET code; Unlimited usage in console, Win. Forms, WPF, and ASP. NET applications; Independence of third party components; Unicode support; Separation of parsing and the actual interpretation of the RTF data; Providing simple predefined conversion modules for text, images, XML, and HTML; Ready- to- Use RTF converter applications for text, images, XML, and HTML; Open architecture for simple creation of RTF converters. Weak(points)The component offers no high- level functionality to create RTF content. The present RTF interpreter is restricted to content data and basic formatting options; There is no special support for the following RTF layout elements: (Tables)(Lists)Automatic numbering. All features which require knowledge of how Microsoft Word might mean it. In general, this should not pose a big problem for many areas of use. A conforming RTF writer should always write content with readers in mind that they do not know about tags and features which were introduced later in the standards history. As a consequence, a lot of the content in an RTF document is stored several times (at least if the writer cares about other applications). This is taken advantage of by the interpreter here, which just simply focuses on the visual content. Some writers in common use, however, improperly support this alternate representation which will result in differences in the resulting output. Thanks to its open architecture, the RTF parser is a solid base for development of an RTF converter which focuses on layout. RTF2. XML/XHTML - RTF Parser and convertion from rtf to xml, xtml. The actual parsing of the data is being done by the class Rtf. Parser. Apart from the tag recognition, it also handles (a first level of) character encoding and Unicode support. The RTF parser classifies the RTF data into the following basic elements: RTF Group: A group of RTF elements; RTF Tag: The name and value of an RTF tag; RTF Text: Arbitrary text content (not necessarily visible!). Figure 1. The actual parsing process can be monitored by Parser. Listeners (Observer Pattern), which offers an opportunity to react on specific events and perform corresponding actions. The integrated parser listener Rtf. Parser. Listener. File. Logger can be used to write the structure of the RTF elements into a log file (mainly intended for use during development). The produced output can be customized using its Rtf. Parser. Logger. Settings. The additional Rtf. Parser. Listener. Logger parser listener can be used to log the parsing process to any ILogger implementation (see System functions). The parser listener Rtf. Parser. Listener. Structure. Builder generates the Structure Model from the RTF elements encountered during parsing. That model represents the basic elements as instances of IRtf. Group, IRtf. Tag, and IRtf. Text. Access to the hierarchical structure can be gained through the RTF group available in Rtf. Parser. Listener. Structure. Builder. Structure. Root. Based on the Visitor Pattern, it is easily possible to examine the structure model via any IRtf. Element. Visitor implementation: //- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- publicclass My. Visitor : IRtf. Element. Visitor{void(Rtf. Write. Structure. Model()){Rtf. Parser. Listener. File. Logger logger =new Rtf. Parser. Listener. File. Logger( @"c: \temp\Rtf. Parser. log" ); IRTFGroup structure. Root =Rtf. Parser. Tool. Parse( @"{\rtf. Root. Visit( this ); } // Rtf. Write. Structure. Model // - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - void IRtf. Element. Visitor. Visit. Tag( IRtf. Tag tag ){Console. Write. Line( "Tag: " + tag. Full. Name ); } // IRtf. Element. Visitor. Visit. Tag // - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - void IRtf. Element. Visitor. Visit. Group( IRtf. Group group ){Console. Write. Line( "Group: " + group. Destination ); foreach ( IRtf. Element child in group. Contents ){child. Visit( this ); // recursive}} // IRtf. Element. Visitor. Visit. Group// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -void IRtf. Element. Visitor. Visit. Text( IRtf. Text text ){Console. Write. Line( "Text: " + text. Text ); } // IRtf. Element. Visitor. Visit. Text} // My. Visitor Figure 2. Note, however, that the same result for such simple functionality could be achieved by writing a custom IRtf. Parser. Listener (see below). This can, in some cases, be useful to avoid the overhead of creating the structure model in memory. The utility class Rtf. Parser. Tool offers the possibility to receive RTF data from a multitude of sources, such as string, Text. Reader, and Stream. And it allows, via its IRtf. Source interface, to handle all these (and even other) scenarios in a uniform way. The interface IRtf. Parser. Listener with its base utility implementation Rtf. Parser. Listener. Base offers a way to react in custom ways to specific events during the parsing process: // - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -publicclass My. Parser. Listener : Rtf. Parser. Listener. Base{// - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -protected override void Do. Parse. Begin(){Console. Write. Line( "parse begin" ); } // Do. Parse. Begin // - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - protected override void Do. Group. Begin(){Console. Write. Line( "group begin - level " + Level. To. String() ); } // Do. Group. Begin // - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - protected override void Do. Tag. Found( IRtf. Tag tag ){Console. Write. Line( "tag " + tag. Full. Name ); } // Do. Tag. Found // - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - protected override void Do. Text. Found( IRtf. Text text ){Console. Write. Line( "text " + text. Text ); } // Do. Text. Found // - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - protected override void Do. Group. End(){Console. Write. Line( "group end - level " + Level. To. String() ); } // Do. Group. End // - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -protected override void Do. Parse. Success(){Console. Write. Line( "parse success" ); } // Do. Parse. Success // - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - protected override void Do. Parse. Fail( Rtf. Exception reason ){Console. Write. Line( "parse failed: " + reason. Message ); } // Do. Parse. Fail // - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - protected override void Do. Parse. End(){Console. Write. Line( "parse end" ); } // Do. Parse. End } // My. Parser. Listener. Note that the used base class already provides (empty) implementations for all the interface methods, so only the ones which are required for a specific purpose need to be overridden. RTF(Interpreter)Once an RTF document has been parsed into a structure model, it is subject to interpretation through the RTF interpreter. One obvious way to interpret the structure is to build a Document Model which provides high- level access to the meaning of the document's contents. A very simple document model is part of this component, and consists of the following building blocks: Document info: title, subject, author etc. User properties Color information Font information Text formats Visuals: Text with associated formatting information (Breaks) : line, paragraph, section, page. Special characters: tabulator, paragraph begin/end, dash, space, bullet, quote, hyphen (Images)Figure 3. Rtf Converter for WPFThe various Visuals represent the recognized visible RTF elements, and can be examined with any IRtf. Visual. Visitor implementation. The various Visuals represent the recognized visible RTF elements, and can be examined with any IRtf. Visual. Visitor implementation. Analogous to the possibilities of the RTF parser, the provided Rtf. Interpreter supports monitoring the interpretation process with Interpreter. Listeners for specific purposes. Analyzing documents might be simplified by using the Rtf. Interpreter. Listener. File. Logger interpreter listener, which writes the recognized RTF elements into a log file. Its output can be customized through its Rtf. Interpreter. Logger. Settings. The additional Rtf. Interpreter. Listener. Logger interpreter listener can be used to log the interpretation process to any ILogger implementation (see System functions). Inside the Canon RAW format version 2, understanding . CR2 file format and files produced by Canon EOS Digital Camera. Many thanks to Whang Sung Ming for his many 7. D samples! Image File Directory. An given IFD contains all necessary information to read the associated picture. Offset Size in bytes Description 0x. N) 0x. 02/2 1. 2 entry#0 0x. N- 1) 1. 2 entry #N- 1 2+1. N 4 next IFD offset. IFD Entry. A TIFF tag, is a logical entity which consist in: an record (Directory Entry) inside an IFD, and some data. These two parts are generally separated. All directory entries are a sequence inside the same IFD, the data can be anywhere in the file. Offset Size in bytes Description 0 2 tag ID 2 2 tag type: 1 = unsigned char. IEEE format. 12 = float, 8 bytes, IEEE format 4 4 number of value 8 4 value, or pointer to the data. As a summary, here is the structure of a TIFF file with 2 IFDs. TIFF structure (picture by C. Rousseau). Remember that there is exactly on picture encoded per IFD, with different compression methods and sizes. The first IFD is containing a small RGB version of the picture (one fourth. Jpeg, the EXIF. part and the Makernote part. See Exiftool Canon Makernote for all known Makernote values and meaning. The picture in IFD #0, for the 4. D, has 2. 25. 6x. For. the 4. 0D, the dimension is 1. TIFF tags are. Tag value Name Type Length Description 0x. Width. 3=unsigned_short 1 1. D2. 25. 6 for the 4. D 0x. 01. 01 / 2. Length. 3=unsigned_short 1 1. D1. 50. 4 for the 4. D 0x. 01. 02 / 2. Per. Sample 3=unsigned_short 3 [8,8,8] 0x. Canon" 0x. 01. 10 / 2. Examples: "Canon EOS 4. D" or "Canon EOS 4. D" 0x. 01. 11 / 2. Offset 4=pointer 1 pointer to the image data in this IFD 0x. Byte. Counts 4=long 1 size in bytes of the image data in this IFD 0x. Resolution 5=rational 1 7. Resolution 5=rational 1 7. Unit 3=unsigned_short 1 2="pixels per inche" 0x. Time 2=string 2. 0 "2. EXIF 4=pointer contains the EXIF sub directory 0x. GPS data 4=pointer points to the GPS data 2. EXIF tags Tag value Name Type Length Description 0x. Time 5=rational 1 exposure time. Number 5=rational 1 f. Number. 6. 68=4 (f/4. Makernote pointer contains the Makenote sub directory 2. Makernote. page for all Canon tags details. Tag value Name Type Length Description 0x. Camera. Settings 3=unsigned_short 4. Info 3=unsigned_short 4 focus info 0x. Type 2=string 1. 5Examples: "Canon EOS 4. D" 0x. 00. 97 Dust. Delete. Data 7=byte sequence 1. See United States Patent 7. Info 3=unsigned_short 1. Offset Name Type Length Description 0x. Width short 1 3. 94. D, 4. 31. 2 for the 4. D, 3. 94. 8 for the 1. D 0x. 00. 02 / 2 sensor. Height short 1 2. D, 2. 87. 6 for the 4. D, 2. 62. 2 for the 1. D 0x. 00. 05 / 5 sensor. Left. Border short 1 4. D, 3. 2 for the 4. D, 5. 2 for the 1. D 0x. 00. 06 / 6 sensor. Top. Border short 1 2. D, 2. 3 for the 4. D, 2. 3 for the 1. D 0x. 00. 07 / 7 sensor. Right. Border short 1 3. D, 4. 30. 3 for the 4. D, 3. 93. 9 for the 1. D 0x. 00. 08 / 8 sensor. Bottom. Border short 1 2. D, 2. 87. 0 for the 4. D, 2. 61. 4 for the 1. D 0x. 00. 09 / 9 black. Mask. Left. Border short 1 0x. Mask. Top. Border short 1 0x. Mask. Right. Border short 1 0x. Mask. Bottom. Border short 1 0x. Balance 3=unsigned_short variable. D exists for all EOS models, and for the G1. Offset Name Type Length Description 0x. D and 4. 00. D) RGGB_Level_As_Shot short 4 Example: [2. R, G1, G2, B] white balance levels. D Mark II, 2. 0D, 1. Ds Mark II and 3. D only. no tag since the 5. D 0x. 40. 04 ? 3=unsigned_short 3. D Mark II and 1. Ds Mark II only. D and for the 5. D Mark II. Only in . cr. 2, not in . Black. Level? 3=unsigned_short 3 since the 5. D. always [1. 29, 1. D, often [0, 0, 0]. D Mark III and 1. Ds Mark III : [6. D and 1. D Mark II N : [1. D. Empty string. 0x. D. Empty string. 0x. D. Empty string. 0x. AFMicro. Adj long 5 for 1d m. Vignetting Correction. See bytes 1. 16 (6. G1. 1 and S9. 0) since 5. D. for 5. 0D, 5. D Mark II, 7. D, S9. 0 and G1. 1. Offset Name Type Length Description 0x. S9. 0 and G1. 1) 0x. G1. 1 and S9. 0) 0x. Correction applied short 1 1=yes, 0=no 0x. S9. 0 0x. 00. 0c DPP correction value short 1 0x. S9. 0 0x. 00. 14 flags? D and the 5. 0D, 0x. D and 5. 50. D, 0x. D Mark II, 0x. 7ee for S9. G1. 1 0x. 00. 16 Image. Width short 1 4. 75. D and 5. 0D, 5. 18. D and 5. 50. D, 5. D Mark II, 4. 89. DMark. IV, 3. 64. S9. 0 and G1. 1 0x. Image. Height short 1 3. D and 5. 0D, 3. 45. D and 5. 50. D, 3. D Mark II, 3. 26. DMark. IV, 2. 73. S9. 0 and G1. 1 0x. Lenses related data bytes? EF 8. 5mm f/1. 2 L II USM = 7. DF 0. 8 9. 2 0. C CA 0. E FF 0. F. EF 1. 7- 4. L USM = 7. 0 0. DF 0. 8 9. 2 0. C CA 0. E FF 0. F. EF 7. 0- 3. IS USM = 7. 0 0. DF 0. 8 9. 2 0. C CA 0. E FF 0. F. EF 2. 4- 7. L f/2. 8 USM = 7. DF 0. 8 9. 2 0. C CA 0. E FF 0. F. EF 7. 0- 2. L IS USM = 7. 0 0. DF 0. 8 9. 2 0. C CA 0. E FF 0. F. EF 7. 0- 2. L IS USM = 3. 8 0. D 0. 9 9. 2 0. C 0. C 0. E FF 0. F. EF 1. L IS USM = 7. 0 0. DF 0. 8 9. 2 0. C CA 0. E FF 0. F. EF 1. 00mm f/2. Macro USM (1. 90) = 7. DF 0. 8 9. 2 0. C CA 0. E FF 0. F. EF 1. 00mm 2. IS USM Macro (2. 54)= 7. DF 0. 8 9. 2 0. C 0. C 0. E FF 0. F. EF 2. L IS USM = 7. 0 0. DF 0. 8 9. 2 0. C 0. C 0. E FF 0. F. EF 2. IS USM = 7. 0 0. DF 0. 8 9. 2 0. C 0. C 0. E FF 0. F. EF 2. USM = 7. 0 0. 4 2. D4 0. B 4. F 0. D FF 0. F. EFS 1. 5- 8. 5mm f/3. IS USM = B2 0. 3 EA 0. A 0. A. EFS 1. 8- 5. IS = B2 0. 3 EA 0. DF 0. 8 1. A 0. A. EFS 1. 7- 5. 5 f/2. IS USM = B2 0. EA 0. 5 6. 5 0. 7 DF 0. A 0. A. EFS 1. 7- 8. IS USM = B2 0. EA 0. 5 2. 2 0. 8 DF 0. A 0. A. EFS 6. 0 f/2. Macro USm = B2 0. EA 0. 5 2. 2 0. 8 9. D 0. 9 1. A 0. A. EFS 1. 8- 1. 35 f/3. IS = B2 0. 3 2. D 0. 5 EA 0. 5 6. A 0. A. EFS 1. 0- 2. USM = 3. 8 0. 2 2. D 0. 5 6. 5 0. 7 DF 0. A 0. A. EFS 1. 8- 2. IS = F5 0. 2 6. DF 0. 8 9. D 0. 9 1. A 0. A. EF 3. 00mm f/2. L IS USM (1. Dm. 4) = F5 0. EA 0. 5 5. A 0. A D4 0. B FF 0. F. EF 1. 6- 3. L II USM(1. Dm. 4)= F5 0. EA 0. 5 5. A 0. A D4 0. B FF 0. F. 0x. 00. NOT time value depend. D. for 5. 0D and 5. D Mark II. [2. 4, 0, 1, 0, 1, 1]. See Peripheral Illumination Correction. G1. 1. 0x. 40. 17 ? D. for 5. 0D and 5. D Mark II. 0x. 40. D. 1. 2=3*sizeof(long). D. empty. values for unknown tagsmodel. D Mark II, 2. 0D, 1. Ds Mark II, 3. 50. D, 5. D, 1. D Mark IIn, 3. D, 4. 00. D2no tagno tag. D Mark. III raw and sraw. G9. 2no tagno tag. D raw and sraw. 23[4. Ds Mark. III2. 3[4. Ds Mark. III sraw. D2. 3[5. 36,3. 56,3,0]1. D2. 3[4. 86,3. 23,0,1]5. D2. 3[5. 94,3. 96,9,0]5. D sraw. 1, sraw. 22. G1. 0, SX1 IS, G1. S9. 0, S9. 52. 3[0,0,0,0]5. D Mark II2. 3[3. 48,2. D Mark II sraw. 12. D Mark II sraw. 22. D2. 3[5. 94, 3. 96, 9, 0]7. D2. 3[6. 48, 4. 32, 2. D mraw, sraw. 23[4. D Mark IV2. 3[6. 12, 4. D2. 3[6. 50, 4. 32, 1. D2. 3[6. 50, 4. 32, 1. D mraw, sraw. 23[4. D Mark III raw. 23[5. Start of TIFF RGB uncompressed image data for IFD 2, data length 1. M. O.. G.>..|. 4a 0. J.@.. U. T.. i. j.| etc.. End of image data. The fourth IFD is containing the RAW data compressed in lossless Jpeg. The RAW offset field in the CR2 header is pointing to the beginning of. This picture, once decoded, maybe split in several vertical strips, like for the 3. D or the 5. D. Each strip is then decoded from left to right. The tag 0xc. 64. 0 is indicating this specificity: If the tag is absent, the picture in in one part (like with the 2. D). if it is present, it indicates the number of verticals strips, and their width. For the 4. 50. D, it is a 2. Tag value Name Type Length Description 0x. Jpeg 0x. 01. 11 / 2. Strip. Offset 4=unsigned_long 1 offset to the RAW image data 0x. Strip. Byte. Counts 4=unsigned_long 1 length of the RAW image data 0xc. D, 4. 50. D, G9, 4. D, 5. D, 1. Ds Mark. III. 0 for 1. D Mark. II, 2. 0D. 0xc. 5e. D, which means 2 first. D, which means 1 first strip of 1. D Raw, 4. 50. D, 1. D, 5. 0D Raw, 5. D Mark II and 1. Ds. Mark. III Raw, 4 for 4. D s. Raw, 5. 0D s. Raw. 1+s. Raw. 2, 5. D Mark II s. Raw. Raw. 2 and 1. Ds Mark. III s. Raw. no tag for G9, 5. D, 3. 50. D, 2. 0D. See section 9. 1 for the values of the 0x. C6. 40 tag per models. Start of Scan", 0x. FFDA Offset Length Type Content Value 0x. Start of Scan marker 0xffda 0x. DC table index, (4bits) AC table index Example (4. D): index=1, DC table=0, AC table=0index=2, DC table=1, AC table=0 0x. Se : End of spectral selection not used: 0 0x. Ah : 4bit, Successive approximation bit position high. Al : 4bit, Successive approximation bit position lowor poin transform here: 0. Decoding image data. The 0xc. 64. 0 tag content (cr. A 4. 50. D RAW picture has a sensor size of 4. Info section, in Makernote section), stored from left to right. The jpeg picture height value is 2. The jpeg. picture is 2. The output of the jpeg lossless decompressiong is a Color Filter Array (CFA) picture. It means that each pixel of the sensor receive only of one value either for red, for green or for blue. For Canon, the CFA has a 2x. One red measurement, one blue and is done for 4 pixels. By nature of a CFA picture. Each pixel is sub- sampled for green in 5. The interpolation will create a 4. RGB picture from a. CFA picture. 4*3. Red, Green. 1, Blue and. Green. 2 values. Green information is recorded 2 more times then Red and. Blue information. The arrangement of the. Color Filter Array.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
September 2016
Categories |