Exemplo n.º 1
0
 /// <summary>
 /// Return a user friendly representation of this class
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return("DisplaySettingsInfo { width : " + Width.ToString() +
            " / height : " + Height.ToString() +
            " / bpp : " + BitsPerPixel.ToString() +
            " / frequency : " + Frequency.ToString() +
            " / PositionX: " + PositionX.ToString() +
            " / PositionY: " + PositionY.ToString() + " }");
 }
Exemplo n.º 2
0
        /// <summary>
        /// Loads a Bitmap into the BitmapX
        /// </summary>
        /// <param name="bitmap">Bitmap Source</param>
        public void LoadBitmap(Bitmap bitmap)
        {
            // Dispose the Original if exists
            BitmapSource?.Dispose();

            // Get Bpp
            _BitsPerPixel = Image.GetPixelFormatSize(bitmap.PixelFormat);

            // Check for supported Bpp
            if (!AcceptedBitsPerPixel.Contains(BitsPerPixel))
            {
                throw new ArgumentException("Unsupported Bitmap Pixel Size: " + BitsPerPixel.ToString());
            }

            // Set Bitmap
            BitmapSource = bitmap;

            // Set Width + Height
            _Width  = BitmapSource.Width;
            _Height = BitmapSource.Height;

            LockBits();
        }