/[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 167 - (hide annotations) (download)
Thu Jul 22 14:55:47 2010 UTC (9 years, 2 months ago) by william
File size: 27513 byte(s)
support pixel export to image

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

  ViewVC Help
Powered by ViewVC 1.1.22