2007-05-30 Sebastien Pouliot <sebastien@ximian.com>
[mono.git] / mcs / class / System.Drawing / System.Drawing.Imaging / BitmapData.cs
1 //
2 // System.Drawing.Imaging.BitmapData.cs
3 //
4 // Author:
5 //   Miguel de Icaza (miguel@ximian.com)
6 //   Vladimir Vukicevic (vladimir@pobox.com)
7 //
8 // (C) 2002 Ximian, Inc.  http://www.ximian.com
9 // Copyright (C) 2004, 2006 Novell, Inc (http://www.novell.com)
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30
31 using System.Runtime.InteropServices;
32
33 namespace System.Drawing.Imaging
34 {
35         // MUST BE KEPT IN SYNC WITH gdip.h in libgdiplus!
36         // The first 6 fields MUST also match MS definition
37 #if TARGET_JVM
38         [MonoTODO]
39 #endif
40         [StructLayout(LayoutKind.Sequential)]
41         public sealed class BitmapData {
42                 private int             width;
43                 private int             height;
44                 private int             stride;
45                 private PixelFormat     pixel_format; // int
46                 private IntPtr          scan0;
47                 private int             reserved;
48
49                 // *** Warning ***      don't depend on those fields in managed
50                 //                      code as they won't exists when using MS
51                 //                      GDI+
52                 private IntPtr  palette;
53                 private int             property_count;
54                 private IntPtr  property;
55                 private float           dpi_horz;
56                 private float           dpi_vert;
57                 private int             image_flags;
58                 private int             left;
59                 private int             top;
60                 private int             x;
61                 private int             y;
62                 private int             transparent;
63                 // *** Warning ***
64
65
66                 public int Height {
67                         get {
68                                 return height;
69                         }
70
71                         set {
72                                 height = value;
73                         }
74                 }
75
76                 public int Width {
77                         get {
78                                 return width;
79                         }
80
81                         set {
82                                 width = value;
83                         }
84                 }
85
86                 public PixelFormat PixelFormat {
87                         get {
88                                 
89                                 return pixel_format;
90                         }
91
92                         set {
93                                 pixel_format = value;
94                         }
95                 }
96
97                 public int Reserved {
98                         get {
99                                 return reserved;
100                         }
101
102                         set {
103                                 reserved = value;
104                         }
105                 }
106
107                 public IntPtr Scan0 {
108                         get {
109                                 return scan0;
110                         }
111
112                         set {
113                                 scan0 = value;
114                         }
115                 }
116
117                 public int Stride {
118                         get {
119                                 return stride;
120                         }
121
122                         set {
123                                 stride = value;
124                         }
125                 }
126         }
127 }