/[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 148 - (hide annotations) (download)
Tue Jul 20 08:11:31 2010 UTC (9 years, 2 months ago) by william
File size: 26124 byte(s)
Coreapi -> Fix importing of constant granny pixel layouts
** Needed to marshal the data using PtrToStructure (twice)

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

  ViewVC Help
Powered by ViewVC 1.1.22