コード例 #1
0
        public AboutBox()
        {
            InitializeComponent();

            this.Icon = Resources.zss_main;
            Bitmap bmp = Resources.main;

            bmp          = ColorMatrices.ApplyColorMatrix(bmp, ColorMatrices.InverseFilter());
            bmp          = ColorMatrices.ApplyColorMatrix(bmp, ColorMatrices.SaturationFilter(-250));
            pbLogo.Image = bmp;
            this.Text    = String.Format("About {0}", AssemblyTitle);
            this.labelProductName.Text = AssemblyProduct;
            this.labelVersion.Text     = String.Format("Version {0}", Application.ProductVersion);
            this.lblRev.Location       = new Point(this.labelVersion.Left + this.labelVersion.Width + 10, this.labelVersion.Top);
            this.lblRev.Text           = string.Format("Rev. {0}", Adapter.AppRevision);
            this.labelCopyright.Text   = AssemblyCopyright;
            lblDevelopers.Text         = string.Format("{0} is developed by:", AssemblyTitle);
            Timer timer = new Timer {
                Interval = 100
            };

            timer.Tick += new EventHandler(timer_Tick);
            timer.Start();
            this.FormClosing += (v1, v2) => timer.Dispose();
        }
コード例 #2
0
        private static Image PrepareBevel(Image image, Point[] points, int filterValue)
        {
            Bitmap       bmp = new Bitmap(image.Width, image.Height);
            Graphics     g   = Graphics.FromImage(bmp);
            GraphicsPath gp  = new GraphicsPath();

            gp.AddPolygon(points);
            g.Clear(Color.Transparent);
            g.SetClip(gp);
            g.DrawImage(image, new Rectangle(0, 0, image.Width, image.Height));
            g.Dispose();
            ColorMatrix cm;

            switch (Engine.conf.BevelFilterType)
            {
            default:
            case FilterType.Brightness:
                cm = ColorMatrices.BrightnessFilter(filterValue);
                break;

            case FilterType.Contrast:
                cm = ColorMatrices.ContrastFilter(filterValue);
                break;

            case FilterType.Saturation:
                cm = ColorMatrices.SaturationFilter(filterValue);
                break;
            }
            bmp = ColorMatrices.ApplyColorMatrix(bmp, cm);
            Graphics g2 = Graphics.FromImage(image);

            g2.DrawImage(bmp, new Rectangle(0, 0, image.Width, image.Height));
            g2.Dispose();
            return(image);
        }
コード例 #3
0
        public static Bitmap GetRandomLogo(Bitmap logo)
        {
            Bitmap bmp = new Bitmap(logo);

            if (mLogoRandomList.Count == 0)
            {
                List <int> numbers = Enumerable.Range(1, 7).ToList();

                int count = numbers.Count;

                for (int x = 0; x < count; x++)
                {
                    int r = Adapter.RandomNumber(0, numbers.Count - 1);
                    mLogoRandomList.Add(numbers[r]);
                    numbers.RemoveAt(r);
                }
            }

            switch (mLogoRandomList[0])
            {
            case 1:
                logo = ColorMatrices.ApplyColorMatrix(bmp, ColorMatrices.InverseFilter());
                break;

            case 2:
                logo = ColorMatrices.ApplyColorMatrix(bmp, ColorMatrices.GrayscaleFilter());
                break;

            case 3:
                logo = ColorMatrices.ApplyColorMatrix(bmp, ColorMatrices.GrayscaleFilter());
                logo = ColorMatrices.ApplyColorMatrix(bmp, ColorMatrices.InverseFilter());
                break;

            case 4:
                logo = ColorMatrices.ApplyColorMatrix(bmp, ColorMatrices.InverseFilter());
                logo = ColorMatrices.ApplyColorMatrix(bmp, ColorMatrices.SaturationFilter(Adapter.RandomNumber(100, 300)));
                break;

            case 5:
                logo = ColorMatrices.ApplyColorMatrix(bmp, ColorMatrices.InverseFilter());
                logo = ColorMatrices.ApplyColorMatrix(bmp, ColorMatrices.SaturationFilter(Adapter.RandomNumber(-300, -100)));
                break;

            case 6:
                logo = ColorMatrices.ApplyColorMatrix(bmp, ColorMatrices.SaturationFilter(Adapter.RandomNumber(150, 300)));
                break;

            case 7:
                logo = ColorMatrices.ApplyColorMatrix(bmp, ColorMatrices.SaturationFilter(Adapter.RandomNumber(-300, -150)));
                break;
            }

            mLogoRandomList.RemoveAt(0);

            return(logo);
        }
コード例 #4
0
        private void timer_Tick(object sender, EventArgs e)
        {
            if (saturation > 400)
            {
                step = -20;
            }
            else if (saturation < 200)
            {
                step = 20;
            }

            saturation += step;

            Bitmap bmp = Resources.main;

            bmp          = ColorMatrices.ApplyColorMatrix(bmp, ColorMatrices.InverseFilter());
            bmp          = ColorMatrices.ApplyColorMatrix(bmp, ColorMatrices.SaturationFilter(-saturation * multiply));
            pbLogo.Image = bmp;
        }
コード例 #5
0
        /// <summary>
        /// Crop shot or Selected Window captures
        /// </summary>
        /// <param name="myImage">Fullscreen image</param>
        /// <param name="windowMode">True = Selected window, False = Crop shot</param>
        public Crop(Image myImage, bool windowMode)
        {
            InitializeComponent();
            selectedWindowMode = windowMode;
            bmpClean           = new Bitmap(myImage);
            bmpBackground      = new Bitmap(bmpClean);
            bmpRegion          = new Bitmap(bmpClean);
            Bounds             = CaptureHelpers.GetScreenBounds();
            this.CursorPos     = this.PointToClient(Cursor.Position);
            rectIntersect.Size = new Size(Bounds.Width - 1, Bounds.Height - 1);
            SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
            CalculateBoundaryFromMousePosition();
            timer.Tick       += new EventHandler(TimerTick);
            windowCheck.Tick += new EventHandler(WindowCheckTick);

            if (selectedWindowMode)
            {
                captureObjects = Engine.ConfigUI.SelectedWindowCaptureObjects;
                myRectangle    = new DynamicRectangle(CaptureType.SELECTED_WINDOW);
                WindowsListAdvanced wla = new WindowsListAdvanced();
                wla.IgnoreWindows.Add(Handle);
                wla.IncludeChildWindows = captureObjects;
                windows = wla.GetWindowsRectangleList();
            }
            else
            {
                myRectangle = new DynamicRectangle(CaptureType.CROP);

                if (Engine.ConfigUI.UseHardwareCursor)
                {
                    Cursor = Cursors.Cross;
                }
                else
                {
                    Cursor.Hide();
                }
            }

            using (Graphics gBackground = Graphics.FromImage(bmpBackground))
                using (Graphics gRegion = Graphics.FromImage(bmpRegion))
                {
                    gBackground.SmoothingMode = SmoothingMode.HighQuality;
                    gRegion.SmoothingMode     = SmoothingMode.HighQuality;

                    if ((selectedWindowMode && Engine.ConfigUI.SelectedWindowRegionStyles == RegionStyles.REGION_TRANSPARENT) ||
                        (!selectedWindowMode && Engine.ConfigUI.CropRegionStyles == RegionStyles.REGION_TRANSPARENT))
                    { // If Region Transparent
                        gRegion.FillRectangle(new SolidBrush(Color.FromArgb(Engine.ConfigUI.RegionTransparentValue, Color.White)),
                                              new Rectangle(0, 0, bmpRegion.Width, bmpRegion.Height));
                    }
                    else if ((selectedWindowMode && Engine.ConfigUI.SelectedWindowRegionStyles == RegionStyles.REGION_BRIGHTNESS) ||
                             (!selectedWindowMode && Engine.ConfigUI.CropRegionStyles == RegionStyles.REGION_BRIGHTNESS))
                    { // If Region Brightness
                        ImageAttributes imgattr = new ImageAttributes();
                        imgattr.SetColorMatrix(ColorMatrices.BrightnessFilter(Engine.ConfigUI.RegionBrightnessValue));
                        gRegion.DrawImage(bmpClean, new Rectangle(0, 0, bmpRegion.Width, bmpRegion.Height), 0, 0,
                                          bmpRegion.Width, bmpRegion.Height, GraphicsUnit.Pixel, imgattr);
                    }
                    else if ((selectedWindowMode && Engine.ConfigUI.SelectedWindowRegionStyles == RegionStyles.BACKGROUND_REGION_TRANSPARENT) ||
                             (!selectedWindowMode && Engine.ConfigUI.CropRegionStyles == RegionStyles.BACKGROUND_REGION_TRANSPARENT))
                    { // If Background Region Transparent
                        gBackground.FillRectangle(new SolidBrush(Color.FromArgb(Engine.ConfigUI.BackgroundRegionTransparentValue, Color.White)),
                                                  new Rectangle(0, 0, bmpBackground.Width, bmpBackground.Height));
                    }
                    else if ((selectedWindowMode && Engine.ConfigUI.SelectedWindowRegionStyles == RegionStyles.BACKGROUND_REGION_BRIGHTNESS) ||
                             (!selectedWindowMode && Engine.ConfigUI.CropRegionStyles == RegionStyles.BACKGROUND_REGION_BRIGHTNESS))
                    { // If Background Region Brightness
                        ImageAttributes imgattr = new ImageAttributes();
                        imgattr.SetColorMatrix(ColorMatrices.BrightnessFilter(Engine.ConfigUI.BackgroundRegionBrightnessValue));
                        gBackground.DrawImage(bmpClean, new Rectangle(0, 0, bmpBackground.Width, bmpBackground.Height), 0, 0,
                                              bmpBackground.Width, bmpBackground.Height, GraphicsUnit.Pixel, imgattr);
                    }
                    else if ((selectedWindowMode && Engine.ConfigUI.SelectedWindowRegionStyles == RegionStyles.BACKGROUND_REGION_GRAYSCALE) ||
                             (!selectedWindowMode && Engine.ConfigUI.CropRegionStyles == RegionStyles.BACKGROUND_REGION_GRAYSCALE))
                    { // If Background Region Grayscale
                        ImageAttributes imgattr = new ImageAttributes();
                        imgattr.SetColorMatrix(ColorMatrices.GrayscaleFilter());
                        gBackground.DrawImage(bmpClean, new Rectangle(0, 0, bmpBackground.Width, bmpBackground.Height), 0, 0,
                                              bmpBackground.Width, bmpBackground.Height, GraphicsUnit.Pixel, imgattr);
                    }
                }

            brushClean      = new TextureBrush(bmpClean);
            brushBackground = new TextureBrush(bmpBackground);
            brushRegion     = new TextureBrush(bmpRegion);
        }