Пример #1
0
            //public Square(Engine engine, Bitmap bitmap, int x, int y)
            public Square(Engine engine, BGRA* Data, int Width, int Height, int x, int y)
            {
                m_Engine = engine;

                // 0 1 2
                // 3 4 5
                // 6 7 8

                m_Colors[0] = GetColor(Data, Width, Height, x - 1, y - 1);
                m_Colors[1] = GetColor(Data, Width, Height, x, y - 1);
                m_Colors[2] = GetColor(Data, Width, Height, x + 1, y - 1);
                m_Colors[3] = GetColor(Data, Width, Height, x - 1, y);
                m_Colors[4] = GetColor(Data, Width, Height, x, y);
                m_Colors[5] = GetColor(Data, Width, Height, x + 1, y);
                m_Colors[6] = GetColor(Data, Width, Height, x - 1, y + 1);
                m_Colors[7] = GetColor(Data, Width, Height, x, y + 1);
                m_Colors[8] = GetColor(Data, Width, Height, x + 1, y + 1);

                // 0 1 2
                // 3   4
                // 5 6 7

                m_Shape[1 << 0] = m_Engine.Threshold.Similar(m_Colors[4], m_Colors[0]);
                m_Shape[1 << 1] = m_Engine.Threshold.Similar(m_Colors[4], m_Colors[1]);
                m_Shape[1 << 2] = m_Engine.Threshold.Similar(m_Colors[4], m_Colors[2]);
                m_Shape[1 << 3] = m_Engine.Threshold.Similar(m_Colors[4], m_Colors[3]);
                m_Shape[1 << 4] = m_Engine.Threshold.Similar(m_Colors[4], m_Colors[5]);
                m_Shape[1 << 5] = m_Engine.Threshold.Similar(m_Colors[4], m_Colors[6]);
                m_Shape[1 << 6] = m_Engine.Threshold.Similar(m_Colors[4], m_Colors[7]);
                m_Shape[1 << 7] = m_Engine.Threshold.Similar(m_Colors[4], m_Colors[8]);
            }
Пример #2
0
 public Square(Engine engine)
 {
     m_Engine = engine;
 }