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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 173 by william, Thu Jul 22 15:54:29 2010 UTC revision 187 by william, Sat Jul 24 04:16:43 2010 UTC
# Line 1  Line 1 
1  ´╗┐using System;  ´╗┐#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;  using System.Collections.Generic;
4  using System.Linq;  using System.Linq;
5  using System.Text;  using System.Text;
# Line 8  using System.Runtime.InteropServices; Line 9  using System.Runtime.InteropServices;
9  namespace gr2lib.core.typedefs  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      public enum granny_pixel_layout
18      {      {
19          GrannyRGB555PixelFormat,          GrannyRGB555PixelFormat,
# Line 22  namespace gr2lib.core.typedefs Line 28  namespace gr2lib.core.typedefs
28          GrannyBGRA5551PixelFormat,          GrannyBGRA5551PixelFormat,
29          GrannyBGRA4444PixelFormat,          GrannyBGRA4444PixelFormat,
30          GrannyBGR888PixelFormat,          GrannyBGR888PixelFormat,
31          GrannyBGRA8888PixelFormat          GrannyBGRA8888PixelFormat,
32            GrannyABGR8888PixelFormat
33      }      }
34        #endregion
35    
36        #region public struct granny_pixel_layouts
37      public struct granny_pixel_layouts      public struct granny_pixel_layouts
38      {      {
39            #region GetPixelLayoutFromEnum(granny_pixel_layout layout_type)
40          public static Layout GetPixelLayoutFromEnum(granny_pixel_layout layout_type)          public static Layout GetPixelLayoutFromEnum(granny_pixel_layout layout_type)
41          {          {
42              switch (layout_type)              switch (layout_type)
# Line 48  namespace gr2lib.core.typedefs Line 57  namespace gr2lib.core.typedefs
57                  default: return granny_pixel_layouts.GrannyDefaultPixelLayout;                  default: return granny_pixel_layouts.GrannyDefaultPixelLayout;
58              }              }
59          }          }
60            #endregion
   
61          #region Pixel Layout: GrannyDefaultPixelLayout          #region Pixel Layout: GrannyDefaultPixelLayout
62          /// <summary>          /// <summary>
63          /// default pixel layout (GrannyRGBA8888PixelFormat)          /// default pixel layout (GrannyRGBA8888PixelFormat)
64          /// </summary>          /// </summary>
65          public static Layout GrannyDefaultPixelLayout          public static Layout GrannyDefaultPixelLayout
66          {          {
67                #region Get GrannyDefaultPixelLayout
68              get              get
69              {              {
70                  return GetPixelLayoutFromEnum(granny_pixel_layout.GrannyRGBA8888PixelFormat);                  return GetPixelLayoutFromEnum(granny_pixel_layout.GrannyRGBA8888PixelFormat);
71              }              }
72                #endregion
73          }          }
74          #endregion          #endregion
   
75          #region Pixel Layout: GrannyRGB555PixelFormat          #region Pixel Layout: GrannyRGB555PixelFormat
76          /// <summary>          /// <summary>
77          /// 16bpp  5-bit red, 5-bit green, 5-bit blue          /// 16bpp  5-bit red, 5-bit green, 5-bit blue
# Line 102  namespace gr2lib.core.typedefs Line 111  namespace gr2lib.core.typedefs
111              #endregion              #endregion
112          }          }
113          #endregion          #endregion
   
   
114          #region Pixel Layout: GrannyRGB565PixelFormat          #region Pixel Layout: GrannyRGB565PixelFormat
115          /// <summary>          /// <summary>
116          /// 16bpp  5-bit red, 6-bit green, 5-bit blue          /// 16bpp  5-bit red, 6-bit green, 5-bit blue
# Line 143  namespace gr2lib.core.typedefs Line 150  namespace gr2lib.core.typedefs
150              #endregion              #endregion
151          }          }
152          #endregion          #endregion
   
153          #region Pixel Layout: GrannyRGBA5551PixelFormat          #region Pixel Layout: GrannyRGBA5551PixelFormat
154          /// <summary>          /// <summary>
155          /// 16bpp  5-bit red, 5-bit green, 5-bit blue, 1-bit alpha          /// 16bpp  5-bit red, 5-bit green, 5-bit blue, 1-bit alpha
# Line 339  namespace gr2lib.core.typedefs Line 345  namespace gr2lib.core.typedefs
345              #endregion              #endregion
346          }          }
347          #endregion          #endregion
348    
349            #region Pixel Layout: GrannyABGR8888PixelFormat
350            /// <summary>
351            /// 32bpp  8-bit red, 8-bit green, 8-bit blue, 8-bit alpha
352            /// </summary>
353            public static Layout GrannyABGR8888PixelFormat
354            {
355                #region Get GrannyABGR8888PixelFormat Layout
356                get
357                {
358                    Layout _tmp_layout = granny_pixel_layouts.GrannyARGB8888PixelFormat;
359    
360                    unsafe
361                    {
362                        IntPtr layoutPTR = (IntPtr)_tmp_layout.BytesPerPixel;
363                        _tmp_layout.NativePointer = layoutPTR;
364                    }            
365    
366                    int R = _tmp_layout.ShiftForComponent[1];
367                    int B = _tmp_layout.ShiftForComponent[3];
368    
369                    // swap R & B
370                    _tmp_layout.ShiftForComponent[1] = B;
371                    _tmp_layout.ShiftForComponent[3] = R;
372                    return _tmp_layout;
373                }
374                #endregion
375            }
376            #endregion
377    
378          #region Pixel Layout: GrannyBGR555PixelFormat          #region Pixel Layout: GrannyBGR555PixelFormat
379          /// <summary>          /// <summary>
380          /// 16bpp  5-bit blue, 5-bit green, 5-bit red          /// 16bpp  5-bit blue, 5-bit green, 5-bit red
# Line 574  namespace gr2lib.core.typedefs Line 610  namespace gr2lib.core.typedefs
610          }          }
611          #endregion          #endregion
612      }      }
613        #endregion
614    
615    #if HIDE_MISSING_XML_COMMENTS_FOR_TYPEDEFS
616    #pragma warning restore 1591
617    #endif
618  }  }

Legend:
Removed from v.173  
changed lines
  Added in v.187

  ViewVC Help
Powered by ViewVC 1.1.22