/[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 191 - (hide annotations) (download)
Sat Jul 24 06:31:50 2010 UTC (9 years, 4 months ago) by william
File size: 29192 byte(s)
In coreapi:
*Add more texture methods
*Move everthing into related classes, to group related methods,etc
*Update all classes to use these grouped classes

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 191 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
85 william 148 if (hdl != IntPtr.Zero)
86     {
87 william 191 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyRGB555PixelFormat");
88 william 148 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 191 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
124 william 148 if (hdl != IntPtr.Zero)
125     {
126 william 191 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyRGB565PixelFormat");
127 william 148 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 191 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
163 william 148 if (hdl != IntPtr.Zero)
164     {
165 william 191 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyRGBA5551PixelFormat");
166 william 148 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 191 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
202 william 148 if (hdl != IntPtr.Zero)
203     {
204 william 191 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyRGBA4444PixelFormat");
205 william 148 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 191 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
241 william 148 if (hdl != IntPtr.Zero)
242     {
243 william 191 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyRGB888PixelFormat");
244 william 148 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 191 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
280 william 148 if (hdl != IntPtr.Zero)
281     {
282 william 191 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyRGBA8888PixelFormat");
283 william 148 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 191 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
319 william 148 if (hdl != IntPtr.Zero)
320     {
321 william 191 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyARGB8888PixelFormat");
322 william 148 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 #region Pixel Layout: GrannyABGR8888PixelFormat
349     /// <summary>
350     /// 32bpp 8-bit red, 8-bit green, 8-bit blue, 8-bit alpha
351     /// </summary>
352     public static Layout GrannyABGR8888PixelFormat
353     {
354     #region Get GrannyABGR8888PixelFormat Layout
355     get
356     {
357 william 189 Layout _tmp_layout = granny_pixel_layouts.GrannyARGB8888PixelFormat;
358 william 187 unsafe
359     {
360 william 189 GCHandle layoutHandle = GCHandle.Alloc(_tmp_layout.BytesPerPixel, GCHandleType.Pinned);
361     _tmp_layout.NativePointer = layoutHandle.AddrOfPinnedObject();
362     layoutHandle.Free();
363 william 187 }
364     int R = _tmp_layout.ShiftForComponent[1];
365     int B = _tmp_layout.ShiftForComponent[3];
366    
367     // swap R & B
368     _tmp_layout.ShiftForComponent[1] = B;
369     _tmp_layout.ShiftForComponent[3] = R;
370     return _tmp_layout;
371     }
372     #endregion
373     }
374     #endregion
375 william 147 #region Pixel Layout: GrannyBGR555PixelFormat
376     /// <summary>
377 william 148 /// 16bpp 5-bit blue, 5-bit green, 5-bit red
378 william 147 /// </summary>
379     public static Layout GrannyBGR555PixelFormat
380     {
381 william 148 #region Get GrannyBGR555PixelFormat Layout
382 william 147 get
383     {
384 william 191 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
385 william 148 if (hdl != IntPtr.Zero)
386     {
387 william 191 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyBGR555PixelFormat");
388 william 148 if (addr != IntPtr.Zero)
389     {
390     gr2lib.core.coretypes.native.Layout _native_ptr;
391     gr2lib.core.coretypes.native.Layout _native;
392     Layout _tmp_layout = new Layout();
393     _native_ptr = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure(addr, typeof(gr2lib.core.coretypes.native.Layout));
394     _native = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure((IntPtr)_native_ptr.BytesPerPixel, typeof(gr2lib.core.coretypes.native.Layout));
395 william 152 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
396 william 148 _tmp_layout.BytesPerPixel = _native.BytesPerPixel;
397     _tmp_layout.ShiftForComponent = _native.ShiftForComponent;
398     _tmp_layout.BitsForComponent = _native.BitsForComponent;
399     return _tmp_layout;
400     }
401     else
402     {
403     return new Layout();
404     }
405     }
406     else
407     {
408     return new Layout();
409     }
410 william 147 }
411 william 148 #endregion
412 william 147 }
413     #endregion
414     #region Pixel Layout: GrannyBGR565PixelFormat
415     /// <summary>
416 william 148 /// 16bpp 5-bit blue, 6-bit green, 5-bit red
417 william 147 /// </summary>
418     public static Layout GrannyBGR565PixelFormat
419     {
420 william 148 #region Get GrannyBGR565PixelFormat Layout
421 william 147 get
422     {
423 william 191 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
424 william 148 if (hdl != IntPtr.Zero)
425     {
426 william 191 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyBGR565PixelFormat");
427 william 148 if (addr != IntPtr.Zero)
428     {
429     gr2lib.core.coretypes.native.Layout _native_ptr;
430     gr2lib.core.coretypes.native.Layout _native;
431     Layout _tmp_layout = new Layout();
432     _native_ptr = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure(addr, typeof(gr2lib.core.coretypes.native.Layout));
433     _native = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure((IntPtr)_native_ptr.BytesPerPixel, typeof(gr2lib.core.coretypes.native.Layout));
434 william 152 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
435 william 148 _tmp_layout.BytesPerPixel = _native.BytesPerPixel;
436     _tmp_layout.ShiftForComponent = _native.ShiftForComponent;
437     _tmp_layout.BitsForComponent = _native.BitsForComponent;
438     return _tmp_layout;
439     }
440     else
441     {
442     return new Layout();
443     }
444     }
445     else
446     {
447     return new Layout();
448     }
449 william 147 }
450 william 148 #endregion
451 william 147 }
452     #endregion
453     #region Pixel Layout: GrannyBGRA5551PixelFormat
454     /// <summary>
455     /// 16bpp 5-bit blue, 5-bit green, 5-bit red, 1-bit alpha
456     /// </summary>
457     public static Layout GrannyBGRA5551PixelFormat
458     {
459 william 148 #region Get GrannyBGRA5551PixelFormat Layout
460 william 147 get
461     {
462 william 191 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
463 william 148 if (hdl != IntPtr.Zero)
464     {
465 william 191 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyBGRA5551PixelFormat");
466 william 148 if (addr != IntPtr.Zero)
467     {
468     gr2lib.core.coretypes.native.Layout _native_ptr;
469     gr2lib.core.coretypes.native.Layout _native;
470     Layout _tmp_layout = new Layout();
471     _native_ptr = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure(addr, typeof(gr2lib.core.coretypes.native.Layout));
472     _native = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure((IntPtr)_native_ptr.BytesPerPixel, typeof(gr2lib.core.coretypes.native.Layout));
473 william 152 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
474 william 148 _tmp_layout.BytesPerPixel = _native.BytesPerPixel;
475     _tmp_layout.ShiftForComponent = _native.ShiftForComponent;
476     _tmp_layout.BitsForComponent = _native.BitsForComponent;
477     return _tmp_layout;
478     }
479     else
480     {
481     return new Layout();
482     }
483     }
484     else
485     {
486     return new Layout();
487     }
488 william 147 }
489 william 148 #endregion
490 william 147 }
491     #endregion
492     #region Pixel Layout: GrannyBGRA4444PixelFormat
493     /// <summary>
494 william 148 /// 16bpp 4-bit blue, 4-bit green, 4-bit red, 4-bit alpha
495 william 147 /// </summary>
496     public static Layout GrannyBGRA4444PixelFormat
497     {
498 william 148 #region Get GrannyBGRA4444PixelFormat Layout
499 william 147 get
500     {
501 william 191 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
502 william 148 if (hdl != IntPtr.Zero)
503     {
504 william 191 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyBGRA4444PixelFormat");
505 william 148 if (addr != IntPtr.Zero)
506     {
507     gr2lib.core.coretypes.native.Layout _native_ptr;
508     gr2lib.core.coretypes.native.Layout _native;
509     Layout _tmp_layout = new Layout();
510     _native_ptr = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure(addr, typeof(gr2lib.core.coretypes.native.Layout));
511     _native = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure((IntPtr)_native_ptr.BytesPerPixel, typeof(gr2lib.core.coretypes.native.Layout));
512 william 152 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
513 william 148 _tmp_layout.BytesPerPixel = _native.BytesPerPixel;
514     _tmp_layout.ShiftForComponent = _native.ShiftForComponent;
515     _tmp_layout.BitsForComponent = _native.BitsForComponent;
516     return _tmp_layout;
517     }
518     else
519     {
520     return new Layout();
521     }
522     }
523     else
524     {
525     return new Layout();
526     }
527 william 147 }
528 william 148 #endregion
529 william 147 }
530     #endregion
531     #region Pixel Layout: GrannyBGR888PixelFormat
532     /// <summary>
533     /// 24bpp 8-bit blue, 8-bit green, 8-bit red
534     /// </summary>
535     public static Layout GrannyBGR888PixelFormat
536     {
537 william 148 #region Get GrannyBGR888PixelFormat Layout
538 william 147 get
539     {
540 william 191 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
541 william 148 if (hdl != IntPtr.Zero)
542     {
543 william 191 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyBGR888PixelFormat");
544 william 148 if (addr != IntPtr.Zero)
545     {
546     gr2lib.core.coretypes.native.Layout _native_ptr;
547     gr2lib.core.coretypes.native.Layout _native;
548     Layout _tmp_layout = new Layout();
549     _native_ptr = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure(addr, typeof(gr2lib.core.coretypes.native.Layout));
550     _native = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure((IntPtr)_native_ptr.BytesPerPixel, typeof(gr2lib.core.coretypes.native.Layout));
551 william 152 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
552 william 148 _tmp_layout.BytesPerPixel = _native.BytesPerPixel;
553     _tmp_layout.ShiftForComponent = _native.ShiftForComponent;
554     _tmp_layout.BitsForComponent = _native.BitsForComponent;
555     return _tmp_layout;
556     }
557     else
558     {
559     return new Layout();
560     }
561     }
562     else
563     {
564     return new Layout();
565     }
566 william 147 }
567 william 148 #endregion
568 william 147 }
569     #endregion
570     #region Pixel Layout: GrannyBGRA8888PixelFormat
571     /// <summary>
572     /// 32bpp 8-bit blue, 8-bit green, 8-bit red, 8-bit alpha
573     /// </summary>
574     public static Layout GrannyBGRA8888PixelFormat
575     {
576 william 148 #region Get GrannyBGRA8888PixelFormat Layout
577 william 147 get
578     {
579 william 191 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
580 william 148 if (hdl != IntPtr.Zero)
581     {
582 william 191 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyBGRA8888PixelFormat");
583 william 148 if (addr != IntPtr.Zero)
584     {
585     gr2lib.core.coretypes.native.Layout _native_ptr;
586     gr2lib.core.coretypes.native.Layout _native;
587     Layout _tmp_layout = new Layout();
588     _native_ptr = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure(addr, typeof(gr2lib.core.coretypes.native.Layout));
589     _native = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure((IntPtr)_native_ptr.BytesPerPixel, typeof(gr2lib.core.coretypes.native.Layout));
590 william 152 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
591 william 148 _tmp_layout.BytesPerPixel = _native.BytesPerPixel;
592     _tmp_layout.ShiftForComponent = _native.ShiftForComponent;
593     _tmp_layout.BitsForComponent = _native.BitsForComponent;
594     return _tmp_layout;
595     }
596     else
597     {
598     return new Layout();
599     }
600     }
601     else
602     {
603     return new Layout();
604     }
605 william 147 }
606 william 148 #endregion
607 william 147 }
608     #endregion
609     }
610 william 187 #endregion
611    
612     #if HIDE_MISSING_XML_COMMENTS_FOR_TYPEDEFS
613     #pragma warning restore 1591
614     #endif
615 william 147 }

  ViewVC Help
Powered by ViewVC 1.1.22