MetaHeader.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. //
  2. // System.Drawing.Imaging.MetaHeader.cs
  3. //
  4. // Authors:
  5. // Everaldo Canuto ([email protected])
  6. // Andreas Nahr ([email protected])
  7. // Dennis Hayes ([email protected])
  8. // Sebastien Pouliot <[email protected]>
  9. //
  10. // (C) 2002 Ximian, Inc. http://www.ximian.com
  11. // Copyright (C) 2004, 2006 Novell, Inc (http://www.novell.com)
  12. //
  13. // Permission is hereby granted, free of charge, to any person obtaining
  14. // a copy of this software and associated documentation files (the
  15. // "Software"), to deal in the Software without restriction, including
  16. // without limitation the rights to use, copy, modify, merge, publish,
  17. // distribute, sublicense, and/or sell copies of the Software, and to
  18. // permit persons to whom the Software is furnished to do so, subject to
  19. // the following conditions:
  20. //
  21. // The above copyright notice and this permission notice shall be
  22. // included in all copies or substantial portions of the Software.
  23. //
  24. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  26. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  27. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  28. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  29. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  30. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  31. //
  32. using System.Runtime.InteropServices;
  33. namespace System.Drawing.Imaging {
  34. [StructLayout (LayoutKind.Sequential, Pack=2)]
  35. internal struct WmfMetaHeader {
  36. // field order match: http://wvware.sourceforge.net/caolan/ora-wmf.html
  37. // for WMFHEAD structure
  38. public short file_type;
  39. public short header_size;
  40. public short version;
  41. public int file_size;
  42. public short num_of_objects;
  43. public int max_record_size;
  44. public short num_of_params;
  45. }
  46. [StructLayout (LayoutKind.Sequential)]
  47. public sealed class MetaHeader {
  48. private WmfMetaHeader wmf;
  49. public MetaHeader ()
  50. {
  51. }
  52. internal MetaHeader (WmfMetaHeader header)
  53. {
  54. wmf.file_type = header.file_type;
  55. wmf.header_size = header.header_size;
  56. wmf.version = header.version;
  57. wmf.file_size = header.file_size;
  58. wmf.num_of_objects = header.num_of_objects;
  59. wmf.max_record_size = header.max_record_size;
  60. wmf.num_of_params = header.num_of_params;
  61. }
  62. public short HeaderSize {
  63. get { return wmf.header_size; }
  64. set { wmf.header_size = value; }
  65. }
  66. public int MaxRecord {
  67. get { return wmf.max_record_size; }
  68. set { wmf.max_record_size = value; }
  69. }
  70. public short NoObjects {
  71. get { return wmf.num_of_objects; }
  72. set { wmf.num_of_objects = value; }
  73. }
  74. public short NoParameters {
  75. get { return wmf.num_of_params; }
  76. set { wmf.num_of_params = value; }
  77. }
  78. public int Size {
  79. get { return wmf.file_size; }
  80. set { wmf.file_size = value; }
  81. }
  82. public short Type {
  83. get { return wmf.file_type; }
  84. set { wmf.file_type = value; }
  85. }
  86. public short Version {
  87. get { return wmf.version; }
  88. set { wmf.version = value; }
  89. }
  90. }
  91. }