コード例 #1
0
        public static bool Reshape(ANDROIDBITMAP bmp, ANDROIDBITMAP.Config fmt, int w, int h)
        {
            if (bmp == null)
            {
                throw new ArgumentNullException(nameof(bmp));
            }
            if (fmt == null)
            {
                throw new Diagnostics.PixelFormatNotSupportedException(fmt, nameof(fmt));
            }
            if (w <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(w));
            }
            if (h <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(h));
            }

            if (bmp.Width == w && bmp.Height == h && bmp.GetConfig() == fmt)
            {
                return(false);
            }

            if (!bmp.IsMutable)
            {
                throw new ArgumentException(nameof(bmp));
            }

            bmp.Reconfigure(w, h, fmt);
            return(true);
        }