/[gr2lib]/trunk/gr2lib/core/typedefs/granny_pixel_layouts.cs
ViewVC logotype

Annotation of /trunk/gr2lib/core/typedefs/granny_pixel_layouts.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 187 - (hide annotations) (download)
Sat Jul 24 04:16:43 2010 UTC (9 years, 4 months ago) by william
File size: 28649 byte(s)
continue to add xml documentation

1 william 187 #define HIDE_MISSING_XML_COMMENTS_FOR_TYPEDEFS // when defined will disable warnings about missing XML comments for all typedefs (CS1591)
2     using System;
3 william 147 using System.Collections.Generic;
4     using System.Linq;
5     using System.Text;
6     using gr2lib.core.coretypes.implementation;
7     using System.Runtime.InteropServices;
8    
9     namespace gr2lib.core.typedefs
10     {
11    
12 william 187 #if HIDE_MISSING_XML_COMMENTS_FOR_TYPEDEFS
13     #pragma warning disable 1591
14     #endif
15    
16     #region public enum granny_pixel_layout
17 william 147 public enum granny_pixel_layout
18     {
19     GrannyRGB555PixelFormat,
20     GrannyRGB565PixelFormat,
21     GrannyRGBA5551PixelFormat,
22     GrannyRGBA4444PixelFormat,
23     GrannyRGB888PixelFormat,
24     GrannyRGBA8888PixelFormat,
25 william 173 GrannyARGB8888PixelFormat,
26     GrannyBGR555PixelFormat,
27     GrannyBGR565PixelFormat,
28     GrannyBGRA5551PixelFormat,
29     GrannyBGRA4444PixelFormat,
30     GrannyBGR888PixelFormat,
31 william 187 GrannyBGRA8888PixelFormat,
32     GrannyABGR8888PixelFormat
33 william 147 }
34 william 187 #endregion
35 william 147
36 william 187 #region public struct granny_pixel_layouts
37 william 147 public struct granny_pixel_layouts
38     {
39 william 187 #region GetPixelLayoutFromEnum(granny_pixel_layout layout_type)
40 william 147 public static Layout GetPixelLayoutFromEnum(granny_pixel_layout layout_type)
41     {
42     switch (layout_type)
43     {
44     case granny_pixel_layout.GrannyBGR555PixelFormat: return granny_pixel_layouts.GrannyBGR555PixelFormat;
45     case granny_pixel_layout.GrannyBGR565PixelFormat: return granny_pixel_layouts.GrannyBGR565PixelFormat;
46     case granny_pixel_layout.GrannyBGR888PixelFormat: return granny_pixel_layouts.GrannyBGR888PixelFormat;
47     case granny_pixel_layout.GrannyBGRA4444PixelFormat: return granny_pixel_layouts.GrannyBGRA4444PixelFormat;
48     case granny_pixel_layout.GrannyBGRA5551PixelFormat: return granny_pixel_layouts.GrannyBGRA5551PixelFormat;
49     case granny_pixel_layout.GrannyBGRA8888PixelFormat: return granny_pixel_layouts.GrannyBGRA8888PixelFormat;
50     case granny_pixel_layout.GrannyRGB555PixelFormat: return granny_pixel_layouts.GrannyRGB555PixelFormat;
51     case granny_pixel_layout.GrannyRGB565PixelFormat: return granny_pixel_layouts.GrannyRGB565PixelFormat;
52     case granny_pixel_layout.GrannyRGB888PixelFormat: return granny_pixel_layouts.GrannyRGB888PixelFormat;
53     case granny_pixel_layout.GrannyRGBA4444PixelFormat: return granny_pixel_layouts.GrannyRGBA4444PixelFormat;
54     case granny_pixel_layout.GrannyRGBA5551PixelFormat: return granny_pixel_layouts.GrannyRGBA5551PixelFormat;
55     case granny_pixel_layout.GrannyRGBA8888PixelFormat: return granny_pixel_layouts.GrannyRGBA8888PixelFormat;
56     case granny_pixel_layout.GrannyARGB8888PixelFormat: return granny_pixel_layouts.GrannyARGB8888PixelFormat;
57     default: return granny_pixel_layouts.GrannyDefaultPixelLayout;
58     }
59     }
60 william 187 #endregion
61 william 147 #region Pixel Layout: GrannyDefaultPixelLayout
62     /// <summary>
63 william 148 /// default pixel layout (GrannyRGBA8888PixelFormat)
64 william 147 /// </summary>
65     public static Layout GrannyDefaultPixelLayout
66     {
67 william 187 #region Get GrannyDefaultPixelLayout
68 william 147 get
69     {
70     return GetPixelLayoutFromEnum(granny_pixel_layout.GrannyRGBA8888PixelFormat);
71     }
72 william 187 #endregion
73 william 147 }
74     #endregion
75     #region Pixel Layout: GrannyRGB555PixelFormat
76     /// <summary>
77     /// 16bpp 5-bit red, 5-bit green, 5-bit blue
78     /// </summary>
79     public static Layout GrannyRGB555PixelFormat
80     {
81 william 148 #region Get GrannyRGB555PixelFormat Layout
82 william 147 get
83     {
84 william 148 IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
85     if (hdl != IntPtr.Zero)
86     {
87     IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyRGB555PixelFormat");
88     if (addr != IntPtr.Zero)
89     {
90 william 152 gr2lib.core.coretypes.native.Layout _native_ptr;
91 william 148 gr2lib.core.coretypes.native.Layout _native;
92     Layout _tmp_layout = new Layout();
93 william 152 _native_ptr = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure(addr, typeof(gr2lib.core.coretypes.native.Layout));
94     _native = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure((IntPtr)_native_ptr.BytesPerPixel, typeof(gr2lib.core.coretypes.native.Layout));
95     _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
96     _tmp_layout.BytesPerPixel = _native.BytesPerPixel;
97     _tmp_layout.ShiftForComponent = _native.ShiftForComponent;
98     _tmp_layout.BitsForComponent = _native.BitsForComponent;
99 william 148 return _tmp_layout;
100     }
101     else
102     {
103     return new Layout();
104     }
105     }
106     else
107     {
108     return new Layout();
109     }
110 william 147 }
111 william 148 #endregion
112 william 147 }
113     #endregion
114     #region Pixel Layout: GrannyRGB565PixelFormat
115     /// <summary>
116     /// 16bpp 5-bit red, 6-bit green, 5-bit blue
117     /// </summary>
118     public static Layout GrannyRGB565PixelFormat
119     {
120 william 148 #region Get GrannyRGB565PixelFormat Layout
121 william 147 get
122     {
123 william 148 IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
124     if (hdl != IntPtr.Zero)
125     {
126     IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyRGB565PixelFormat");
127     if (addr != IntPtr.Zero)
128     {
129 william 152 gr2lib.core.coretypes.native.Layout _native_ptr;
130 william 148 gr2lib.core.coretypes.native.Layout _native;
131     Layout _tmp_layout = new Layout();
132 william 152 _native_ptr = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure(addr, typeof(gr2lib.core.coretypes.native.Layout));
133     _native = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure((IntPtr)_native_ptr.BytesPerPixel, typeof(gr2lib.core.coretypes.native.Layout));
134     _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
135     _tmp_layout.BytesPerPixel = _native.BytesPerPixel;
136     _tmp_layout.ShiftForComponent = _native.ShiftForComponent;
137     _tmp_layout.BitsForComponent = _native.BitsForComponent;
138 william 148 return _tmp_layout;
139     }
140     else
141     {
142     return new Layout();
143     }
144     }
145     else
146     {
147     return new Layout();
148     }
149 william 147 }
150 william 148 #endregion
151 william 147 }
152     #endregion
153     #region Pixel Layout: GrannyRGBA5551PixelFormat
154     /// <summary>
155     /// 16bpp 5-bit red, 5-bit green, 5-bit blue, 1-bit alpha
156     /// </summary>
157     public static Layout GrannyRGBA5551PixelFormat
158     {
159 william 148 #region Get GrannyRGBA5551PixelFormat Layout
160 william 147 get
161     {
162 william 148 IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
163     if (hdl != IntPtr.Zero)
164     {
165     IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyRGBA5551PixelFormat");
166     if (addr != IntPtr.Zero)
167     {
168 william 152 gr2lib.core.coretypes.native.Layout _native_ptr;
169 william 148 gr2lib.core.coretypes.native.Layout _native;
170     Layout _tmp_layout = new Layout();
171 william 152 _native_ptr = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure(addr, typeof(gr2lib.core.coretypes.native.Layout));
172     _native = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure((IntPtr)_native_ptr.BytesPerPixel, typeof(gr2lib.core.coretypes.native.Layout));
173     _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
174     _tmp_layout.BytesPerPixel = _native.BytesPerPixel;
175     _tmp_layout.ShiftForComponent = _native.ShiftForComponent;
176     _tmp_layout.BitsForComponent = _native.BitsForComponent;
177 william 148 return _tmp_layout;
178     }
179     else
180     {
181     return new Layout();
182     }
183     }
184     else
185     {
186     return new Layout();
187     }
188 william 147 }
189 william 148 #endregion
190 william 147 }
191     #endregion
192     #region Pixel Layout: GrannyRGBA4444PixelFormat
193     /// <summary>
194     /// 16bpp 4-bit red, 4-bit green, 4-bit blue, 4-bit alpha
195     /// </summary>
196     public static Layout GrannyRGBA4444PixelFormat
197     {
198 william 148 #region Get GrannyRGBA4444PixelFormat Layout
199 william 147 get
200     {
201 william 148 IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
202     if (hdl != IntPtr.Zero)
203     {
204     IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyRGBA4444PixelFormat");
205     if (addr != IntPtr.Zero)
206     {
207 william 152 gr2lib.core.coretypes.native.Layout _native_ptr;
208 william 148 gr2lib.core.coretypes.native.Layout _native;
209     Layout _tmp_layout = new Layout();
210 william 152 _native_ptr = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure(addr, typeof(gr2lib.core.coretypes.native.Layout));
211     _native = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure((IntPtr)_native_ptr.BytesPerPixel, typeof(gr2lib.core.coretypes.native.Layout));
212     _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
213     _tmp_layout.BytesPerPixel = _native.BytesPerPixel;
214     _tmp_layout.ShiftForComponent = _native.ShiftForComponent;
215     _tmp_layout.BitsForComponent = _native.BitsForComponent;
216 william 148 return _tmp_layout;
217     }
218     else
219     {
220     return new Layout();
221     }
222     }
223     else
224     {
225     return new Layout();
226     }
227 william 147 }
228 william 148 #endregion
229 william 147 }
230     #endregion
231     #region Pixel Layout: GrannyRGB888PixelFormat
232     /// <summary>
233     /// 24bpp 8-bit red, 8-bit green, 8-bit blue
234     /// </summary>
235     public static Layout GrannyRGB888PixelFormat
236     {
237 william 148 #region Get GrannyRGB888PixelFormat Layout
238 william 147 get
239     {
240 william 148 IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
241     if (hdl != IntPtr.Zero)
242     {
243     IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyRGB888PixelFormat");
244     if (addr != IntPtr.Zero)
245     {
246 william 152 gr2lib.core.coretypes.native.Layout _native_ptr;
247 william 148 gr2lib.core.coretypes.native.Layout _native;
248     Layout _tmp_layout = new Layout();
249 william 152 _native_ptr = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure(addr, typeof(gr2lib.core.coretypes.native.Layout));
250     _native = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure((IntPtr)_native_ptr.BytesPerPixel, typeof(gr2lib.core.coretypes.native.Layout));
251     _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
252     _tmp_layout.BytesPerPixel = _native.BytesPerPixel;
253     _tmp_layout.ShiftForComponent = _native.ShiftForComponent;
254     _tmp_layout.BitsForComponent = _native.BitsForComponent;
255 william 148 return _tmp_layout;
256     }
257     else
258     {
259     return new Layout();
260     }
261     }
262     else
263     {
264     return new Layout();
265     }
266 william 147 }
267 william 148 #endregion
268 william 147 }
269     #endregion
270     #region Pixel Layout: GrannyRGBA8888PixelFormat
271     /// <summary>
272     /// 32bpp 8-bit red, 8-bit green, 8-bit blue, 8-bit alpha
273     /// </summary>
274     public static Layout GrannyRGBA8888PixelFormat
275     {
276 william 148 #region Get GrannyRGBA8888PixelFormat Layout
277 william 147 get
278     {
279 william 148 IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
280     if (hdl != IntPtr.Zero)
281     {
282     IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyRGBA8888PixelFormat");
283     if (addr != IntPtr.Zero)
284     {
285     gr2lib.core.coretypes.native.Layout _native_ptr;
286     gr2lib.core.coretypes.native.Layout _native;
287     Layout _tmp_layout = new Layout();
288     _native_ptr = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure(addr, typeof(gr2lib.core.coretypes.native.Layout));
289     _native = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure((IntPtr)_native_ptr.BytesPerPixel, typeof(gr2lib.core.coretypes.native.Layout));
290 william 152 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
291 william 148 _tmp_layout.BytesPerPixel = _native.BytesPerPixel;
292     _tmp_layout.ShiftForComponent = _native.ShiftForComponent;
293     _tmp_layout.BitsForComponent = _native.BitsForComponent;
294     return _tmp_layout;
295     }
296     else
297     {
298     return new Layout();
299     }
300     }
301     else
302     {
303     return new Layout();
304     }
305 william 147 }
306 william 148 #endregion
307 william 147 }
308     #endregion
309     #region Pixel Layout: GrannyARGB8888PixelFormat
310     /// <summary>
311 william 148 /// 32bpp 8-bit red, 8-bit green, 8-bit blue, 8-bit alpha
312 william 147 /// </summary>
313     public static Layout GrannyARGB8888PixelFormat
314     {
315 william 148 #region Get GrannyARGB8888PixelFormat Layout
316 william 147 get
317     {
318 william 148 IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
319     if (hdl != IntPtr.Zero)
320     {
321     IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyARGB8888PixelFormat");
322     if (addr != IntPtr.Zero)
323     {
324     gr2lib.core.coretypes.native.Layout _native_ptr;
325     gr2lib.core.coretypes.native.Layout _native;
326     Layout _tmp_layout = new Layout();
327     _native_ptr = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure(addr, typeof(gr2lib.core.coretypes.native.Layout));
328     _native = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure((IntPtr)_native_ptr.BytesPerPixel, typeof(gr2lib.core.coretypes.native.Layout));
329 william 152 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
330 william 148 _tmp_layout.BytesPerPixel = _native.BytesPerPixel;
331     _tmp_layout.ShiftForComponent = _native.ShiftForComponent;
332     _tmp_layout.BitsForComponent = _native.BitsForComponent;
333     return _tmp_layout;
334     }
335     else
336     {
337     return new Layout();
338     }
339     }
340     else
341     {
342     return new Layout();
343     }
344 william 147 }
345 william 148 #endregion
346 william 147 }
347     #endregion
348 william 187
349     #region Pixel Layout: GrannyABGR8888PixelFormat
350     /// <summary>
351     /// 32bpp 8-bit red, 8-bit green, 8-bit blue, 8-bit alpha
352     /// </summary>
353     public static Layout GrannyABGR8888PixelFormat
354     {
355     #region Get GrannyABGR8888PixelFormat Layout
356     get
357     {
358     Layout _tmp_layout = granny_pixel_layouts.GrannyARGB8888PixelFormat;
359    
360     unsafe
361     {
362     IntPtr layoutPTR = (IntPtr)_tmp_layout.BytesPerPixel;
363     _tmp_layout.NativePointer = layoutPTR;
364     }
365    
366     int R = _tmp_layout.ShiftForComponent[1];
367     int B = _tmp_layout.ShiftForComponent[3];
368    
369     // swap R & B
370     _tmp_layout.ShiftForComponent[1] = B;
371     _tmp_layout.ShiftForComponent[3] = R;
372     return _tmp_layout;
373     }
374     #endregion
375     }
376     #endregion
377    
378 william 147 #region Pixel Layout: GrannyBGR555PixelFormat
379     /// <summary>
380 william 148 /// 16bpp 5-bit blue, 5-bit green, 5-bit red
381 william 147 /// </summary>
382     public static Layout GrannyBGR555PixelFormat
383     {
384 william 148 #region Get GrannyBGR555PixelFormat Layout
385 william 147 get
386     {
387 william 148 IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
388     if (hdl != IntPtr.Zero)
389     {
390     IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyBGR555PixelFormat");
391     if (addr != IntPtr.Zero)
392     {
393     gr2lib.core.coretypes.native.Layout _native_ptr;
394     gr2lib.core.coretypes.native.Layout _native;
395     Layout _tmp_layout = new Layout();
396     _native_ptr = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure(addr, typeof(gr2lib.core.coretypes.native.Layout));
397     _native = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure((IntPtr)_native_ptr.BytesPerPixel, typeof(gr2lib.core.coretypes.native.Layout));
398 william 152 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
399 william 148 _tmp_layout.BytesPerPixel = _native.BytesPerPixel;
400     _tmp_layout.ShiftForComponent = _native.ShiftForComponent;
401     _tmp_layout.BitsForComponent = _native.BitsForComponent;
402     return _tmp_layout;
403     }
404     else
405     {
406     return new Layout();
407     }
408     }
409     else
410     {
411     return new Layout();
412     }
413 william 147 }
414 william 148 #endregion
415 william 147 }
416     #endregion
417     #region Pixel Layout: GrannyBGR565PixelFormat
418     /// <summary>
419 william 148 /// 16bpp 5-bit blue, 6-bit green, 5-bit red
420 william 147 /// </summary>
421     public static Layout GrannyBGR565PixelFormat
422     {
423 william 148 #region Get GrannyBGR565PixelFormat Layout
424 william 147 get
425     {
426 william 148 IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
427     if (hdl != IntPtr.Zero)
428     {
429     IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyBGR565PixelFormat");
430     if (addr != IntPtr.Zero)
431     {
432     gr2lib.core.coretypes.native.Layout _native_ptr;
433     gr2lib.core.coretypes.native.Layout _native;
434     Layout _tmp_layout = new Layout();
435     _native_ptr = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure(addr, typeof(gr2lib.core.coretypes.native.Layout));
436     _native = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure((IntPtr)_native_ptr.BytesPerPixel, typeof(gr2lib.core.coretypes.native.Layout));
437 william 152 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
438 william 148 _tmp_layout.BytesPerPixel = _native.BytesPerPixel;
439     _tmp_layout.ShiftForComponent = _native.ShiftForComponent;
440     _tmp_layout.BitsForComponent = _native.BitsForComponent;
441     return _tmp_layout;
442     }
443     else
444     {
445     return new Layout();
446     }
447     }
448     else
449     {
450     return new Layout();
451     }
452 william 147 }
453 william 148 #endregion
454 william 147 }
455     #endregion
456     #region Pixel Layout: GrannyBGRA5551PixelFormat
457     /// <summary>
458     /// 16bpp 5-bit blue, 5-bit green, 5-bit red, 1-bit alpha
459     /// </summary>
460     public static Layout GrannyBGRA5551PixelFormat
461     {
462 william 148 #region Get GrannyBGRA5551PixelFormat Layout
463 william 147 get
464     {
465 william 148 IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
466     if (hdl != IntPtr.Zero)
467     {
468     IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyBGRA5551PixelFormat");
469     if (addr != IntPtr.Zero)
470     {
471     gr2lib.core.coretypes.native.Layout _native_ptr;
472     gr2lib.core.coretypes.native.Layout _native;
473     Layout _tmp_layout = new Layout();
474     _native_ptr = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure(addr, typeof(gr2lib.core.coretypes.native.Layout));
475     _native = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure((IntPtr)_native_ptr.BytesPerPixel, typeof(gr2lib.core.coretypes.native.Layout));
476 william 152 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
477 william 148 _tmp_layout.BytesPerPixel = _native.BytesPerPixel;
478     _tmp_layout.ShiftForComponent = _native.ShiftForComponent;
479     _tmp_layout.BitsForComponent = _native.BitsForComponent;
480     return _tmp_layout;
481     }
482     else
483     {
484     return new Layout();
485     }
486     }
487     else
488     {
489     return new Layout();
490     }
491 william 147 }
492 william 148 #endregion
493 william 147 }
494     #endregion
495     #region Pixel Layout: GrannyBGRA4444PixelFormat
496     /// <summary>
497 william 148 /// 16bpp 4-bit blue, 4-bit green, 4-bit red, 4-bit alpha
498 william 147 /// </summary>
499     public static Layout GrannyBGRA4444PixelFormat
500     {
501 william 148 #region Get GrannyBGRA4444PixelFormat Layout
502 william 147 get
503     {
504 william 148 IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
505     if (hdl != IntPtr.Zero)
506     {
507     IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyBGRA4444PixelFormat");
508     if (addr != IntPtr.Zero)
509     {
510     gr2lib.core.coretypes.native.Layout _native_ptr;
511     gr2lib.core.coretypes.native.Layout _native;
512     Layout _tmp_layout = new Layout();
513     _native_ptr = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure(addr, typeof(gr2lib.core.coretypes.native.Layout));
514     _native = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure((IntPtr)_native_ptr.BytesPerPixel, typeof(gr2lib.core.coretypes.native.Layout));
515 william 152 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
516 william 148 _tmp_layout.BytesPerPixel = _native.BytesPerPixel;
517     _tmp_layout.ShiftForComponent = _native.ShiftForComponent;
518     _tmp_layout.BitsForComponent = _native.BitsForComponent;
519     return _tmp_layout;
520     }
521     else
522     {
523     return new Layout();
524     }
525     }
526     else
527     {
528     return new Layout();
529     }
530 william 147 }
531 william 148 #endregion
532 william 147 }
533     #endregion
534     #region Pixel Layout: GrannyBGR888PixelFormat
535     /// <summary>
536     /// 24bpp 8-bit blue, 8-bit green, 8-bit red
537     /// </summary>
538     public static Layout GrannyBGR888PixelFormat
539     {
540 william 148 #region Get GrannyBGR888PixelFormat Layout
541 william 147 get
542     {
543 william 148 IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
544     if (hdl != IntPtr.Zero)
545     {
546     IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyBGR888PixelFormat");
547     if (addr != IntPtr.Zero)
548     {
549     gr2lib.core.coretypes.native.Layout _native_ptr;
550     gr2lib.core.coretypes.native.Layout _native;
551     Layout _tmp_layout = new Layout();
552     _native_ptr = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure(addr, typeof(gr2lib.core.coretypes.native.Layout));
553     _native = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure((IntPtr)_native_ptr.BytesPerPixel, typeof(gr2lib.core.coretypes.native.Layout));
554 william 152 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
555 william 148 _tmp_layout.BytesPerPixel = _native.BytesPerPixel;
556     _tmp_layout.ShiftForComponent = _native.ShiftForComponent;
557     _tmp_layout.BitsForComponent = _native.BitsForComponent;
558     return _tmp_layout;
559     }
560     else
561     {
562     return new Layout();
563     }
564     }
565     else
566     {
567     return new Layout();
568     }
569 william 147 }
570 william 148 #endregion
571 william 147 }
572     #endregion
573     #region Pixel Layout: GrannyBGRA8888PixelFormat
574     /// <summary>
575     /// 32bpp 8-bit blue, 8-bit green, 8-bit red, 8-bit alpha
576     /// </summary>
577     public static Layout GrannyBGRA8888PixelFormat
578     {
579 william 148 #region Get GrannyBGRA8888PixelFormat Layout
580 william 147 get
581     {
582 william 148 IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
583     if (hdl != IntPtr.Zero)
584     {
585     IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyBGRA8888PixelFormat");
586     if (addr != IntPtr.Zero)
587     {
588     gr2lib.core.coretypes.native.Layout _native_ptr;
589     gr2lib.core.coretypes.native.Layout _native;
590     Layout _tmp_layout = new Layout();
591     _native_ptr = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure(addr, typeof(gr2lib.core.coretypes.native.Layout));
592     _native = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure((IntPtr)_native_ptr.BytesPerPixel, typeof(gr2lib.core.coretypes.native.Layout));
593 william 152 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
594 william 148 _tmp_layout.BytesPerPixel = _native.BytesPerPixel;
595     _tmp_layout.ShiftForComponent = _native.ShiftForComponent;
596     _tmp_layout.BitsForComponent = _native.BitsForComponent;
597     return _tmp_layout;
598     }
599     else
600     {
601     return new Layout();
602     }
603     }
604     else
605     {
606     return new Layout();
607     }
608 william 147 }
609 william 148 #endregion
610 william 147 }
611     #endregion
612     }
613 william 187 #endregion
614    
615     #if HIDE_MISSING_XML_COMMENTS_FOR_TYPEDEFS
616     #pragma warning restore 1591
617     #endif
618 william 147 }

  ViewVC Help
Powered by ViewVC 1.1.22