예제 #1
0
        private void CallForBitmap(Action <FastBitmap> func)
        {
            FastBitmap fastBitmap = new FastBitmap(mainBitmap, ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);

            func(fastBitmap);
            fastBitmap.Dispose();
            mainPictureBox.Image = mainBitmap;
        }
예제 #2
0
        public void MouseDown(int x, int y, FastBitmap bitmap)
        {
            if (!usePicture.Checked)
            {
                Fill(x, y, bitmap, (X, Y) => Color);
                return;
            }
            if (bmp == null)
            {
                MessageBox.Show("Вы не выбрали картинку!", "Окошко-всплывашка", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }
            FastBitmap fastBitmap = new FastBitmap(bmp, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
            int        addX       = fastBitmap.Width + bitmap.Width - x;
            int        addY       = fastBitmap.Height + bitmap.Height - y;

            Fill(x, y, bitmap, (X, Y) => fastBitmap.GetPixel((X + addX) % fastBitmap.Width,
                                                             (Y + addY) % fastBitmap.Height));
            fastBitmap.Dispose();
        }