dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/DotGNU.Images BmpReader.cs,1.1,1.2 I


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/DotGNU.Images BmpReader.cs,1.1,1.2 Image.cs,1.1,1.2 Utils.cs,1.1,1.2
Date: Sun, 06 Jul 2003 21:46:19 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/DotGNU.Images
In directory subversions:/tmp/cvs-serv681/DotGNU.Images

Modified Files:
        BmpReader.cs Image.cs Utils.cs 
Log Message:


Move the "bit count to pixel format" conversion into "Utils" so that
other format loaders can share it.


Index: BmpReader.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/DotGNU.Images/BmpReader.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** BmpReader.cs        7 Jul 2003 01:37:41 -0000       1.1
--- BmpReader.cs        7 Jul 2003 01:46:17 -0000       1.2
***************
*** 107,111 ****
                                image.Width = width;
                                image.Height = height;
!                               image.SetBitCount(bitCount);
                                image.LoadFormat = Image.Bmp;
  
--- 107,111 ----
                                image.Width = width;
                                image.Height = height;
!                               image.PixelFormat = 
Utils.BitCountToFormat(bitCount);
                                image.LoadFormat = Image.Bmp;
  

Index: Image.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/DotGNU.Images/Image.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** Image.cs    7 Jul 2003 01:37:41 -0000       1.1
--- Image.cs    7 Jul 2003 01:46:17 -0000       1.2
***************
*** 342,365 ****
                        }
  
-       // Set the pixel format based on a bit count value.
-       public void SetBitCount(int bitCount)
-                       {
-                               switch(bitCount)
-                               {
-                                       case 1:
-                                               PixelFormat = 
PixelFormat.Format1bppIndexed; break;
-                                       case 4:
-                                               PixelFormat = 
PixelFormat.Format4bppIndexed; break;
-                                       case 8:
-                                               PixelFormat = 
PixelFormat.Format8bppIndexed; break;
-                                       case 15:
-                                               PixelFormat = 
PixelFormat.Format16bppRgb555; break;
-                                       case 16:
-                                               PixelFormat = 
PixelFormat.Format16bppRgb565; break;
-                                       case 24:
-                                               PixelFormat = 
PixelFormat.Format24bppRgb; break;
-                               }
-                       }
- 
  }; // class Image
  
--- 342,345 ----

Index: Utils.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/DotGNU.Images/Utils.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** Utils.cs    7 Jul 2003 01:37:41 -0000       1.1
--- Utils.cs    7 Jul 2003 01:46:17 -0000       1.2
***************
*** 189,193 ****
                                        case PixelFormat.Format64bppArgb:       
        return 64;
  
!                                       default:                                
                                return 1;
                                }
                        }
--- 189,219 ----
                                        case PixelFormat.Format64bppArgb:       
        return 64;
  
!                                       default:                                
                                return 32;
!                               }
!                       }
! 
!       // Convert a bit count into a pixel format.
!       public static PixelFormat BitCountToFormat(int bitCount)
!                       {
!                               switch(bitCount)
!                               {
!                                       case 1:
!                                               return 
PixelFormat.Format1bppIndexed;
!                                       case 4:
!                                               return 
PixelFormat.Format4bppIndexed;
!                                       case 8:
!                                               return 
PixelFormat.Format8bppIndexed;
!                                       case 15:
!                                               return 
PixelFormat.Format16bppRgb555;
!                                       case 16:
!                                               return 
PixelFormat.Format16bppRgb565;
!                                       case 24:
!                                               return 
PixelFormat.Format24bppRgb;
!                                       case 32: default:
!                                               return 
PixelFormat.Format32bppRgb;
!                                       case 48:
!                                               return 
PixelFormat.Format48bppRgb;
!                                       case 64:
!                                               return 
PixelFormat.Format64bppArgb;
                                }
                        }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]