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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 191 - (show annotations) (download)
Sat Jul 24 06:31:50 2010 UTC (9 years, 2 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 #define HIDE_MISSING_XML_COMMENTS_FOR_TYPEDEFS // when defined will disable warnings about missing XML comments for all typedefs (CS1591)
2 using System;
3 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 #if HIDE_MISSING_XML_COMMENTS_FOR_TYPEDEFS
13 #pragma warning disable 1591
14 #endif
15
16 #region public enum granny_pixel_layout
17 public enum granny_pixel_layout
18 {
19 GrannyRGB555PixelFormat,
20 GrannyRGB565PixelFormat,
21 GrannyRGBA5551PixelFormat,
22 GrannyRGBA4444PixelFormat,
23 GrannyRGB888PixelFormat,
24 GrannyRGBA8888PixelFormat,
25 GrannyARGB8888PixelFormat,
26 GrannyBGR555PixelFormat,
27 GrannyBGR565PixelFormat,
28 GrannyBGRA5551PixelFormat,
29 GrannyBGRA4444PixelFormat,
30 GrannyBGR888PixelFormat,
31 GrannyBGRA8888PixelFormat,
32 GrannyABGR8888PixelFormat
33 }
34 #endregion
35
36 #region public struct granny_pixel_layouts
37 public struct granny_pixel_layouts
38 {
39 #region GetPixelLayoutFromEnum(granny_pixel_layout layout_type)
40 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 #endregion
61 #region Pixel Layout: GrannyDefaultPixelLayout
62 /// <summary>
63 /// default pixel layout (GrannyRGBA8888PixelFormat)
64 /// </summary>
65 public static Layout GrannyDefaultPixelLayout
66 {
67 #region Get GrannyDefaultPixelLayout
68 get
69 {
70 return GetPixelLayoutFromEnum(granny_pixel_layout.GrannyRGBA8888PixelFormat);
71 }
72 #endregion
73 }
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 #region Get GrannyRGB555PixelFormat Layout
82 get
83 {
84 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
85 if (hdl != IntPtr.Zero)
86 {
87 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyRGB555PixelFormat");
88 if (addr != IntPtr.Zero)
89 {
90 gr2lib.core.coretypes.native.Layout _native_ptr;
91 gr2lib.core.coretypes.native.Layout _native;
92 Layout _tmp_layout = new Layout();
93 _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 return _tmp_layout;
100 }
101 else
102 {
103 return new Layout();
104 }
105 }
106 else
107 {
108 return new Layout();
109 }
110 }
111 #endregion
112 }
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 #region Get GrannyRGB565PixelFormat Layout
121 get
122 {
123 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
124 if (hdl != IntPtr.Zero)
125 {
126 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyRGB565PixelFormat");
127 if (addr != IntPtr.Zero)
128 {
129 gr2lib.core.coretypes.native.Layout _native_ptr;
130 gr2lib.core.coretypes.native.Layout _native;
131 Layout _tmp_layout = new Layout();
132 _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 return _tmp_layout;
139 }
140 else
141 {
142 return new Layout();
143 }
144 }
145 else
146 {
147 return new Layout();
148 }
149 }
150 #endregion
151 }
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 #region Get GrannyRGBA5551PixelFormat Layout
160 get
161 {
162 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
163 if (hdl != IntPtr.Zero)
164 {
165 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyRGBA5551PixelFormat");
166 if (addr != IntPtr.Zero)
167 {
168 gr2lib.core.coretypes.native.Layout _native_ptr;
169 gr2lib.core.coretypes.native.Layout _native;
170 Layout _tmp_layout = new Layout();
171 _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 return _tmp_layout;
178 }
179 else
180 {
181 return new Layout();
182 }
183 }
184 else
185 {
186 return new Layout();
187 }
188 }
189 #endregion
190 }
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 #region Get GrannyRGBA4444PixelFormat Layout
199 get
200 {
201 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
202 if (hdl != IntPtr.Zero)
203 {
204 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyRGBA4444PixelFormat");
205 if (addr != IntPtr.Zero)
206 {
207 gr2lib.core.coretypes.native.Layout _native_ptr;
208 gr2lib.core.coretypes.native.Layout _native;
209 Layout _tmp_layout = new Layout();
210 _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 return _tmp_layout;
217 }
218 else
219 {
220 return new Layout();
221 }
222 }
223 else
224 {
225 return new Layout();
226 }
227 }
228 #endregion
229 }
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 #region Get GrannyRGB888PixelFormat Layout
238 get
239 {
240 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
241 if (hdl != IntPtr.Zero)
242 {
243 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyRGB888PixelFormat");
244 if (addr != IntPtr.Zero)
245 {
246 gr2lib.core.coretypes.native.Layout _native_ptr;
247 gr2lib.core.coretypes.native.Layout _native;
248 Layout _tmp_layout = new Layout();
249 _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 return _tmp_layout;
256 }
257 else
258 {
259 return new Layout();
260 }
261 }
262 else
263 {
264 return new Layout();
265 }
266 }
267 #endregion
268 }
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 #region Get GrannyRGBA8888PixelFormat Layout
277 get
278 {
279 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
280 if (hdl != IntPtr.Zero)
281 {
282 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyRGBA8888PixelFormat");
283 if (addr != IntPtr.Zero)
284 {
285 gr2lib.core.coretypes.native.Layout _native_ptr;
286 gr2lib.core.coretypes.native.Layout _native;
287 Layout _tmp_layout = new Layout();
288 _native_ptr = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure(addr, typeof(gr2lib.core.coretypes.native.Layout));
289 _native = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure((IntPtr)_native_ptr.BytesPerPixel, typeof(gr2lib.core.coretypes.native.Layout));
290 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
291 _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 }
306 #endregion
307 }
308 #endregion
309 #region Pixel Layout: GrannyARGB8888PixelFormat
310 /// <summary>
311 /// 32bpp 8-bit red, 8-bit green, 8-bit blue, 8-bit alpha
312 /// </summary>
313 public static Layout GrannyARGB8888PixelFormat
314 {
315 #region Get GrannyARGB8888PixelFormat Layout
316 get
317 {
318 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
319 if (hdl != IntPtr.Zero)
320 {
321 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyARGB8888PixelFormat");
322 if (addr != IntPtr.Zero)
323 {
324 gr2lib.core.coretypes.native.Layout _native_ptr;
325 gr2lib.core.coretypes.native.Layout _native;
326 Layout _tmp_layout = new Layout();
327 _native_ptr = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure(addr, typeof(gr2lib.core.coretypes.native.Layout));
328 _native = (gr2lib.core.coretypes.native.Layout)Marshal.PtrToStructure((IntPtr)_native_ptr.BytesPerPixel, typeof(gr2lib.core.coretypes.native.Layout));
329 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
330 _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 }
345 #endregion
346 }
347 #endregion
348 #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 Layout _tmp_layout = granny_pixel_layouts.GrannyARGB8888PixelFormat;
358 unsafe
359 {
360 GCHandle layoutHandle = GCHandle.Alloc(_tmp_layout.BytesPerPixel, GCHandleType.Pinned);
361 _tmp_layout.NativePointer = layoutHandle.AddrOfPinnedObject();
362 layoutHandle.Free();
363 }
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 #region Pixel Layout: GrannyBGR555PixelFormat
376 /// <summary>
377 /// 16bpp 5-bit blue, 5-bit green, 5-bit red
378 /// </summary>
379 public static Layout GrannyBGR555PixelFormat
380 {
381 #region Get GrannyBGR555PixelFormat Layout
382 get
383 {
384 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
385 if (hdl != IntPtr.Zero)
386 {
387 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyBGR555PixelFormat");
388 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 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
396 _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 }
411 #endregion
412 }
413 #endregion
414 #region Pixel Layout: GrannyBGR565PixelFormat
415 /// <summary>
416 /// 16bpp 5-bit blue, 6-bit green, 5-bit red
417 /// </summary>
418 public static Layout GrannyBGR565PixelFormat
419 {
420 #region Get GrannyBGR565PixelFormat Layout
421 get
422 {
423 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
424 if (hdl != IntPtr.Zero)
425 {
426 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyBGR565PixelFormat");
427 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 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
435 _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 }
450 #endregion
451 }
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 #region Get GrannyBGRA5551PixelFormat Layout
460 get
461 {
462 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
463 if (hdl != IntPtr.Zero)
464 {
465 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyBGRA5551PixelFormat");
466 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 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
474 _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 }
489 #endregion
490 }
491 #endregion
492 #region Pixel Layout: GrannyBGRA4444PixelFormat
493 /// <summary>
494 /// 16bpp 4-bit blue, 4-bit green, 4-bit red, 4-bit alpha
495 /// </summary>
496 public static Layout GrannyBGRA4444PixelFormat
497 {
498 #region Get GrannyBGRA4444PixelFormat Layout
499 get
500 {
501 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
502 if (hdl != IntPtr.Zero)
503 {
504 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyBGRA4444PixelFormat");
505 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 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
513 _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 }
528 #endregion
529 }
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 #region Get GrannyBGR888PixelFormat Layout
538 get
539 {
540 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
541 if (hdl != IntPtr.Zero)
542 {
543 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyBGR888PixelFormat");
544 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 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
552 _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 }
567 #endregion
568 }
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 #region Get GrannyBGRA8888PixelFormat Layout
577 get
578 {
579 IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
580 if (hdl != IntPtr.Zero)
581 {
582 IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyBGRA8888PixelFormat");
583 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 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
591 _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 }
606 #endregion
607 }
608 #endregion
609 }
610 #endregion
611
612 #if HIDE_MISSING_XML_COMMENTS_FOR_TYPEDEFS
613 #pragma warning restore 1591
614 #endif
615 }

  ViewVC Help
Powered by ViewVC 1.1.22