예제 #1
0
 public override PixelDataProvider CreateSimilar(int width, int height, int numChannels)
 {
     if (numChannels <= 0)
     {
         return(new PixelDataProviderGDI(new Bitmap(width, height, this._bmp.PixelFormat)));
     }
     else
     {
         PixelDataProviderGDI pdp = new PixelDataProviderGDI(width, height, numChannels);
         if (numChannels == 1)
         {
             if (this._bmp.Palette.Entries.Length > 0) //default: grayscale
             {
                 for (int i = 0; i < this._bmp.Palette.Entries.Length; i++)
                 {
                     pdp._bmp.Palette.Entries[i] = this._bmp.Palette.Entries[i];
                 }
             }
         }
         return(pdp);
     }
 }
예제 #2
0
 public override PixelDataProvider CreateSimilar(int width, int height, int numChannels)
 {
     if (numChannels <= 0)
         return new PixelDataProviderGDI(new Bitmap(width, height, this._bmp.PixelFormat));
     else
     {
         PixelDataProviderGDI pdp = new PixelDataProviderGDI(width, height, numChannels);
         if (numChannels == 1)
         {
             if (this._bmp.Palette.Entries.Length > 0) //default: grayscale
             {
                 for (int i = 0; i < this._bmp.Palette.Entries.Length; i++)
                     pdp._bmp.Palette.Entries[i] = this._bmp.Palette.Entries[i];
             }
         }
         return pdp;
     }
 }