Exemple #1
0
        public void Test_Thin()
        {
            var sut = new Thin();

            Assert.True(sut.Name.Equals("Thin"));
            Assert.True(sut.Price.Equals(4.00m));
        }
Exemple #2
0
        private bool Thining(BitmapData bit_old, BitmapData bit_new, int x, int y, Thin thin)
        {
            int[] p = new int[8];
            int   product, sum;
            int   start = (int)thin;

            p[0] = (GetBitmap(bit_old, x - 1, y - 1) == Color.Black.ToArgb() ? 1 : 0);
            p[1] = (GetBitmap(bit_old, x - 1, y) == Color.Black.ToArgb() ? 1 : 0);     // old_pixels[i - 1][j];
            p[2] = (GetBitmap(bit_old, x - 1, y + 1) == Color.Black.ToArgb() ? 1 : 0); // old_pixels[i - 1][j + 1];
            p[3] = (GetBitmap(bit_old, x, y + 1) == Color.Black.ToArgb() ? 1 : 0);     // old_pixels[i][j + 1];
            p[4] = (GetBitmap(bit_old, x + 1, y + 1) == Color.Black.ToArgb() ? 1 : 0); // old_pixels[i + 1][j + 1];
            p[5] = (GetBitmap(bit_old, x + 1, y) == Color.Black.ToArgb() ? 1 : 0);     // old_pixels[i + 1][j];
            p[6] = (GetBitmap(bit_old, x + 1, y - 1) == Color.Black.ToArgb() ? 1 : 0); //old_pixels[i + 1][j - 1];
            p[7] = (GetBitmap(bit_old, x, y - 1) == Color.Black.ToArgb() ? 1 : 0);     // old_pixels[i][j - 1];

            unsafe
            {
                uint *st = (uint *)(void *)bit_new.Scan0;
                for (int k = start; k < start + 3; k++)
                {
                    product = p[k % 8] * p[(k + 1) % 8] * p[(k + 2) % 8];
                    sum     = p[(k + 4) % 8] + p[(k + 5) % 8] + p[(k + 6) % 8];
                    if (product == 1 && sum == 0)
                    {
                        st[y * bit_new.Stride / sizeof(uint) + x] = (uint)Color.White.ToArgb();
                        //new_pixels[i][j] = 0;   //消去する
                        return(true);
                    }
                }
                return(false);
            }
        }
Exemple #3
0
        private void btn_edit_menu_shrinking_Click(object sender, EventArgs e)
        {
            Thin shrink = new Thin();

            apply_effect(shrink);
        }