Exemple #1
0
        public bool Equals(QBitmap <T> other)
        {
            if ((object)other == null)
            {
                return(false);
            }
            if ((object)other == (object)this)
            {
                return(true);
            }

            if (m_HashCode.HasValue && other.m_HashCode.HasValue &&
                m_HashCode.Value != other.m_HashCode.Value)
            {
                return(false);
            }

            if (other.Width != Width || other.Height != Height)
            {
                return(false);
            }

            for (int x = 0; x < Width; x++)
            {
                for (int y = 0; y < Height; y++)
                {
                    if (!s_Comparer.Equals(m_Array[x, y], other.m_Array[x, y]))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Exemple #2
0
        public static Bitmap ToImage <T>(this QBitmap <T> qbitmap, Func <T, Color> pixels)
            where T : struct
        {
            Bitmap bitmap = new Bitmap(qbitmap.Width, qbitmap.Height,
                                       System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            for (int x = 0; x < qbitmap.Width; x++)
            {
                for (int y = 0; y < qbitmap.Height; y++)
                {
                    bitmap.SetPixel(x, y, pixels(qbitmap[x, y]));
                }
            }

            return(bitmap);
        }