예제 #1
0
        public anEngine(int size_x, int size_y, int screen_width, int screen_heigth)
        {
            this.size_x = size_x;
            this.size_y = size_y;
            this.screen_width = screen_width;
            this.screen_heigth = screen_heigth;

            Layers = new List<anLayer>();
            Layers.Add(new anLayer(size_x, size_y)); // добавили первый слой
            ActiveLayerNum = 0;

            standartBrush = new anBrush();
        }
예제 #2
0
파일: anLayer.cs 프로젝트: SirGawain/Design
        public void DrawBrush(anBrush BR, int x, int y)
        {
            //определяем позицию
            int start_X = x - BR.myBrush.Width / 2;
            int start_Y = y - BR.myBrush.Height / 2;
            int end_X = start_X + BR.myBrush.Width;
            int end_Y = start_Y + BR.myBrush.Height;

            //корректируем позицию (не выход за границы)
            if (start_X < 0)
                start_X = 0;
            if (start_Y < 0)
                start_Y = 0;
            if (end_X > width)
                end_X = width;
            if (end_Y > heigth)
                end_Y = heigth;

            //счетчик маски кисти
            int count_X =0, count_Y = 0;

            //наносим кисть на слой
            for(int i = start_X; i < end_X; i++)
            {
                count_Y = 0;
                for(int j=start_Y; j<end_Y; j++)
                {
                    Color temp = BR.myBrush.GetPixel(count_X, count_Y);
                    if(!(temp.R==255 && temp.G==0 && temp.B==0)) //цвет не красный
                    {
                        DrawPlace[i, j, 0] = ActiveColor.R;
                        DrawPlace[i, j, 1] = ActiveColor.G;
                        DrawPlace[i, j, 2] = ActiveColor.B;
                        DrawPlace[i, j, 3] = 1;
                    }
                    count_Y++;
                }
                count_X++;
            }
        }