Esempio n. 1
0
 private void SetImage(Bitmap bmp)
 {
     PixelFormat[] supportedFormats =
     {
         PixelFormat.Format8bppIndexed,
         PixelFormat.Format16bppGrayScale,
         PixelFormat.Format24bppRgb,
         PixelFormat.Format32bppArgb,
         PixelFormat.Format32bppPArgb,
         PixelFormat.Format32bppRgb,
     };
     if (supportedFormats.Contains(bmp.PixelFormat) == false)
     {
         return;
     }
     Util.FreeBuffer(ref imgBuf);
     ImageUtil.BitmapToImageBuffer(bmp, ref imgBuf, ref bw, ref bh, ref bytepp);
     imgBox.SetImageBuffer(imgBuf, bw, bh, bytepp, false);
     imgBox.Invalidate();
 }