/[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 173 - (show annotations) (download)
Thu Jul 22 15:54:29 2010 UTC (9 years, 3 months ago) by william
File size: 27028 byte(s)
rolled my version of: GrannySwapRGBAToBGRA

1 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 /// default pixel layout (GrannyRGBA8888PixelFormat)
56 /// </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 #region Get GrannyRGB555PixelFormat Layout
73 get
74 {
75 IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
76 if (hdl != IntPtr.Zero)
77 {
78 IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyRGB555PixelFormat");
79 if (addr != IntPtr.Zero)
80 {
81 gr2lib.core.coretypes.native.Layout _native_ptr;
82 gr2lib.core.coretypes.native.Layout _native;
83 Layout _tmp_layout = new Layout();
84 _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 return _tmp_layout;
91 }
92 else
93 {
94 return new Layout();
95 }
96 }
97 else
98 {
99 return new Layout();
100 }
101 }
102 #endregion
103 }
104 #endregion
105
106
107 #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 #region Get GrannyRGB565PixelFormat Layout
114 get
115 {
116 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 gr2lib.core.coretypes.native.Layout _native_ptr;
123 gr2lib.core.coretypes.native.Layout _native;
124 Layout _tmp_layout = new Layout();
125 _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 return _tmp_layout;
132 }
133 else
134 {
135 return new Layout();
136 }
137 }
138 else
139 {
140 return new Layout();
141 }
142 }
143 #endregion
144 }
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 #region Get GrannyRGBA5551PixelFormat Layout
154 get
155 {
156 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 gr2lib.core.coretypes.native.Layout _native_ptr;
163 gr2lib.core.coretypes.native.Layout _native;
164 Layout _tmp_layout = new Layout();
165 _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 return _tmp_layout;
172 }
173 else
174 {
175 return new Layout();
176 }
177 }
178 else
179 {
180 return new Layout();
181 }
182 }
183 #endregion
184 }
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 #region Get GrannyRGBA4444PixelFormat Layout
193 get
194 {
195 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 gr2lib.core.coretypes.native.Layout _native_ptr;
202 gr2lib.core.coretypes.native.Layout _native;
203 Layout _tmp_layout = new Layout();
204 _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 return _tmp_layout;
211 }
212 else
213 {
214 return new Layout();
215 }
216 }
217 else
218 {
219 return new Layout();
220 }
221 }
222 #endregion
223 }
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 #region Get GrannyRGB888PixelFormat Layout
232 get
233 {
234 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 gr2lib.core.coretypes.native.Layout _native_ptr;
241 gr2lib.core.coretypes.native.Layout _native;
242 Layout _tmp_layout = new Layout();
243 _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 return _tmp_layout;
250 }
251 else
252 {
253 return new Layout();
254 }
255 }
256 else
257 {
258 return new Layout();
259 }
260 }
261 #endregion
262 }
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 #region Get GrannyRGBA8888PixelFormat Layout
271 get
272 {
273 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 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
285 _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 }
300 #endregion
301 }
302 #endregion
303 #region Pixel Layout: GrannyARGB8888PixelFormat
304 /// <summary>
305 /// 32bpp 8-bit red, 8-bit green, 8-bit blue, 8-bit alpha
306 /// </summary>
307 public static Layout GrannyARGB8888PixelFormat
308 {
309 #region Get GrannyARGB8888PixelFormat Layout
310 get
311 {
312 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 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
324 _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 }
339 #endregion
340 }
341 #endregion
342 #region Pixel Layout: GrannyBGR555PixelFormat
343 /// <summary>
344 /// 16bpp 5-bit blue, 5-bit green, 5-bit red
345 /// </summary>
346 public static Layout GrannyBGR555PixelFormat
347 {
348 #region Get GrannyBGR555PixelFormat Layout
349 get
350 {
351 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 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
363 _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 }
378 #endregion
379 }
380 #endregion
381 #region Pixel Layout: GrannyBGR565PixelFormat
382 /// <summary>
383 /// 16bpp 5-bit blue, 6-bit green, 5-bit red
384 /// </summary>
385 public static Layout GrannyBGR565PixelFormat
386 {
387 #region Get GrannyBGR565PixelFormat Layout
388 get
389 {
390 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 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
402 _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 }
417 #endregion
418 }
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 #region Get GrannyBGRA5551PixelFormat Layout
427 get
428 {
429 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 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
441 _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 }
456 #endregion
457 }
458 #endregion
459 #region Pixel Layout: GrannyBGRA4444PixelFormat
460 /// <summary>
461 /// 16bpp 4-bit blue, 4-bit green, 4-bit red, 4-bit alpha
462 /// </summary>
463 public static Layout GrannyBGRA4444PixelFormat
464 {
465 #region Get GrannyBGRA4444PixelFormat Layout
466 get
467 {
468 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 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
480 _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 }
495 #endregion
496 }
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 #region Get GrannyBGR888PixelFormat Layout
505 get
506 {
507 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 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
519 _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 }
534 #endregion
535 }
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 #region Get GrannyBGRA8888PixelFormat Layout
544 get
545 {
546 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 _tmp_layout.NativePointer = (IntPtr)_native_ptr.BytesPerPixel;
558 _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 }
573 #endregion
574 }
575 #endregion
576 }
577 }

  ViewVC Help
Powered by ViewVC 1.1.22