/[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 152 - (hide annotations) (download)
Tue Jul 20 08:19:37 2010 UTC (9 years, 3 months ago) by william
File size: 27028 byte(s)
missed updating the marhsaling for some of the constant granny pixel layouts

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

  ViewVC Help
Powered by ViewVC 1.1.22