Exemple #1
0
 public override Bitmap Apply(Bitmap bmp)
 {
     using (bmp)
     {
         return(ColorMatrixManager.Polaroid().Apply(bmp));
     }
 }
Exemple #2
0
 public override Bitmap Apply(Bitmap bmp)
 {
     using (bmp)
     {
         return(ColorMatrixManager.Alpha(Value, Addition).Apply(bmp));
     }
 }
Exemple #3
0
 public override Bitmap Apply(Bitmap bmp)
 {
     using (bmp)
     {
         return(ColorMatrixManager.Hue(Angle).Apply(bmp));
     }
 }
Exemple #4
0
 public override Bitmap Apply(Bitmap bmp)
 {
     using (bmp)
     {
         return(ColorMatrixManager.Saturation(Value).Apply(bmp));
     }
 }
Exemple #5
0
 public override Bitmap Apply(Bitmap bmp)
 {
     using (bmp)
     {
         return(ColorMatrixManager.Grayscale(Value).Apply(bmp));
     }
 }
Exemple #6
0
 public override Bitmap Apply(Bitmap bmp)
 {
     using (bmp)
     {
         return(ColorMatrixManager.Brightness(Value).Apply(bmp));
     }
 }
Exemple #7
0
 public override Bitmap Apply(Bitmap bmp)
 {
     using (bmp)
     {
         return(ColorMatrixManager.ChangeGamma(bmp, Value));
     }
 }
Exemple #8
0
 public override Image Apply(Image img)
 {
     using (img)
     {
         return(ColorMatrixManager.Saturation(Value).Apply(img));
     }
 }
Exemple #9
0
 public override Image Apply(Image img)
 {
     using (img)
     {
         return(ColorMatrixManager.Polaroid().Apply(img));
     }
 }
Exemple #10
0
        /// <summary>Must be called before show form</summary>
        public virtual void Prepare()
        {
            if (SurfaceImage == null)
            {
                SurfaceImage = Screenshot.CaptureFullscreen();
            }

            if (Config.UseDimming)
            {
                using (Image darkSurfaceImage = ColorMatrixManager.Contrast(0.9f).Apply(SurfaceImage))
                {
                    darkBackgroundBrush = new TextureBrush(darkSurfaceImage)
                    {
                        WrapMode = WrapMode.Clamp
                    };
                }

                using (Image lightSurfaceImage = ColorMatrixManager.Contrast(1.1f).Apply(SurfaceImage))
                {
                    lightBackgroundBrush = new TextureBrush(lightSurfaceImage)
                    {
                        WrapMode = WrapMode.Clamp
                    };
                }
            }
            else
            {
                darkBackgroundBrush = new TextureBrush(SurfaceImage);
            }
        }
Exemple #11
0
 public override Image Apply(Image img)
 {
     using (img)
     {
         return(ColorMatrixManager.Contrast(Value).Apply(img));
     }
 }
Exemple #12
0
 public override Image Apply(Image img)
 {
     using (img)
     {
         return(ColorMatrixManager.Brightness(Value).Apply(img));
     }
 }
Exemple #13
0
 public override Image Apply(Image img)
 {
     using (img)
     {
         return(ColorMatrixManager.Alpha(Value, Addition).Apply(img));
     }
 }
Exemple #14
0
 public override Bitmap Apply(Bitmap bmp)
 {
     using (bmp)
     {
         return(ColorMatrixManager.Colorize(Color, Value).Apply(bmp));
     }
 }
Exemple #15
0
 public override Image Apply(Image img)
 {
     using (img)
     {
         return(ColorMatrixManager.Hue(Angle).Apply(img));
     }
 }
Exemple #16
0
 public override Image Apply(Image img)
 {
     using (img)
     {
         return(ColorMatrixManager.ChangeGamma(img, Value));
     }
 }
Exemple #17
0
 public override Image Apply(Image img)
 {
     using (img)
     {
         return(ColorMatrixManager.Grayscale(Value).Apply(img));
     }
 }
Exemple #18
0
 public override Image Apply(Image img)
 {
     using (img)
     {
         return(ColorMatrixManager.BlackWhite().Apply(img));
     }
 }
Exemple #19
0
 public override Bitmap Apply(Bitmap bmp)
 {
     using (bmp)
     {
         return(ColorMatrixManager.BlackWhite().Apply(bmp));
     }
 }
Exemple #20
0
        /// <summary>Must be called before show form</summary>
        public virtual void Prepare()
        {
            if (SurfaceImage == null)
            {
                SurfaceImage = Screenshot.CaptureFullscreen();
            }

            using (Image darkSurfaceImage = ColorMatrixManager.Contrast(0.8f).Apply(SurfaceImage))
            {
                darkBackgroundBrush = new TextureBrush(darkSurfaceImage);
            }

            using (Image lightSurfaceImage = ColorMatrixManager.Contrast(1.1f).Apply(SurfaceImage))
            {
                lightBackgroundBrush = new TextureBrush(lightSurfaceImage);
            }
        }
Exemple #21
0
        public override Bitmap Apply(Bitmap bmp)
        {
            if (Opacity < 1 || (SizeMode != DrawImageSizeMode.DontResize && Size.Width <= 0 && Size.Height <= 0))
            {
                return(bmp);
            }

            string imageFilePath = Helpers.ExpandFolderVariables(ImageLocation, true);

            if (!string.IsNullOrEmpty(imageFilePath) && File.Exists(imageFilePath))
            {
                using (Bitmap bmpWatermark = ImageHelpers.LoadImage(imageFilePath))
                {
                    if (bmpWatermark != null)
                    {
                        if (RotateFlip != ImageRotateFlipType.None)
                        {
                            bmpWatermark.RotateFlip((RotateFlipType)RotateFlip);
                        }

                        Size imageSize;

                        if (SizeMode == DrawImageSizeMode.AbsoluteSize)
                        {
                            int width  = Size.Width == -1 ? bmp.Width : Size.Width;
                            int height = Size.Height == -1 ? bmp.Height : Size.Height;
                            imageSize = ImageHelpers.ApplyAspectRatio(width, height, bmpWatermark);
                        }
                        else if (SizeMode == DrawImageSizeMode.PercentageOfWatermark)
                        {
                            int width  = (int)Math.Round(Size.Width / 100f * bmpWatermark.Width);
                            int height = (int)Math.Round(Size.Height / 100f * bmpWatermark.Height);
                            imageSize = ImageHelpers.ApplyAspectRatio(width, height, bmpWatermark);
                        }
                        else if (SizeMode == DrawImageSizeMode.PercentageOfCanvas)
                        {
                            int width  = (int)Math.Round(Size.Width / 100f * bmp.Width);
                            int height = (int)Math.Round(Size.Height / 100f * bmp.Height);
                            imageSize = ImageHelpers.ApplyAspectRatio(width, height, bmpWatermark);
                        }
                        else
                        {
                            imageSize = bmpWatermark.Size;
                        }

                        Point     imagePosition  = Helpers.GetPosition(Placement, Offset, bmp.Size, imageSize);
                        Rectangle imageRectangle = new Rectangle(imagePosition, imageSize);

                        if (AutoHide && !new Rectangle(0, 0, bmp.Width, bmp.Height).Contains(imageRectangle))
                        {
                            return(bmp);
                        }

                        using (Graphics g = Graphics.FromImage(bmp))
                        {
                            g.InterpolationMode = ImageHelpers.GetInterpolationMode(InterpolationMode);
                            g.PixelOffsetMode   = PixelOffsetMode.Half;
                            g.CompositingMode   = CompositingMode;

                            if (Tile)
                            {
                                using (TextureBrush brush = new TextureBrush(bmpWatermark, WrapMode.Tile))
                                {
                                    brush.TranslateTransform(imageRectangle.X, imageRectangle.Y);
                                    g.FillRectangle(brush, imageRectangle);
                                }
                            }
                            else if (Opacity < 100)
                            {
                                using (ImageAttributes ia = new ImageAttributes())
                                {
                                    ColorMatrix matrix = ColorMatrixManager.Alpha(Opacity / 100f);
                                    ia.SetColorMatrix(matrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
                                    g.DrawImage(bmpWatermark, imageRectangle, 0, 0, bmpWatermark.Width, bmpWatermark.Height, GraphicsUnit.Pixel, ia);
                                }
                            }
                            else
                            {
                                g.DrawImage(bmpWatermark, imageRectangle);
                            }
                        }
                    }
                }
            }

            return(bmp);
        }