コード例 #1
0
 public static Bitmap FishEye(Image bitmap)
 {
     if (Effects.curvature != 0)
     {
         Genetibase.BasicFilters.FisheyeFilter f = new Genetibase.BasicFilters.FisheyeFilter();
         f.Curvature = (float)Effects.curvature / 100;
         return((Bitmap)f.ExecuteFilter(bitmap));
     }
     return((Bitmap)bitmap);
 }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: xuchuansheng/GenXSource
        public Bitmap FilterEffects(bool updateDisplay)
        {
            if (Program.Photo != null)
            {
                try
                {                   
                    Bitmap b = (Bitmap)Program.Source.Image.Clone();

                    if (cropData != Rectangle.Empty)
                    {
                        Bitmap oldB = b;
                        b = Operations.Crop(b, (int)(cropData.X * Program.percentage), (int)(cropData.Y * Program.percentage), (int)(cropData.Width * Program.percentage), (int)(cropData.Height * Program.percentage));
                        oldB.Dispose();
                        oldB = null;
                    }                    

                    if (Effects2.Rotate != RotateFlipType.RotateNoneFlipNone)
                    {
                        b.RotateFlip(Effects2.Rotate);
                    }

                    if (Effects2.Flip != RotateFlipType.RotateNoneFlipNone)
                    {
                        b.RotateFlip(Effects2.Flip);
                    }                   

                    Program.Filter.Do(b);
                    //GB
                    b = Program.Effects.Do(b);

                    Effects2.Do(b);

                    WaterMark wm = new WaterMark(this.WaterMarkText, this.TextAlign, this.WaterMarkFont, this.WaterMarkImage, this.ImageAlign);
                    b = (Bitmap)wm.MarkImage(b);


                    if (Effects2.rounded)
                    {
                        Effects2.RoundImageTransparent(b, 50);
                    }

                    if (Effects2.dropshadow)
                    {
                        Genetibase.BasicFilters.DropShadowFilter f3 = new Genetibase.BasicFilters.DropShadowFilter();
                        b = (Bitmap)f3.ExecuteFilter(b);
                    }

                    if (Effects2.curvature != 0)
                    {
                        Genetibase.BasicFilters.FisheyeFilter f = new Genetibase.BasicFilters.FisheyeFilter();
                        f.Curvature = (float)Effects2.curvature / 100;
                        b = (Bitmap)f.ExecuteFilter(b);
                    }

                    if (Effects2.FloorReflectionFilter.DockPosition != DockStyle.None)
                    {
                        Genetibase.BasicFilters.FloorReflectionFilter f = new Genetibase.BasicFilters.FloorReflectionFilter();
                        f.AlphaEnd = Effects2.FloorReflectionFilter.AlphaEnd;
                        f.AlphaStart = Effects2.FloorReflectionFilter.AlphaStart;
                        f.DockPosition = Effects2.FloorReflectionFilter.DockPosition;
                        f.Offset = (int)(Effects2.FloorReflectionFilter.Offset * Program.percentage);

                        b = (Bitmap)f.ExecuteFilter(b);
                    }

                    if (Effects2.BoxFilter.Angle != 0)
                    {
                        Genetibase.BasicFilters.BoxFilter f = new Genetibase.BasicFilters.BoxFilter();
                        f.DrawImageOnSides = Effects2.BoxFilter.DrawImageOnSides;
                        f.BoxStartColor = Effects2.BoxFilter.BoxStartColor;
                        f.BoxEndColor = Effects2.BoxFilter.BoxEndColor;
                        f.BoxDepth = (int)(Effects2.BoxFilter.BoxDepth * Program.percentage);
                        f.Angle = Effects2.BoxFilter.Angle;

                        if (Extra.Enable)
                        {
                            f.BackGroundColor = Extra.BackgroundColor;
                        }

                        b = (Bitmap)f.ExecuteFilter(b);
                    }

                    if (updateDisplay)
                    {
                        Bitmap temp = (Bitmap)Program.Destination.Image;
                        Program.Destination.Image = b;

                        if (temp != null)
                            temp.Dispose();
                    }

                    if (b != null)
                        return (Bitmap)b.Clone();
                    else
                        return null;
                }
                catch (Exception ex)
                {
                    Program.Destination.Image = (Bitmap)Program.Source.Image.Clone();
                }
                finally {  }
            }

            return null;
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: xuchuansheng/GenXSource
        public Bitmap FilterEffectsForSave()
        {
            if (Program.Photo != null)
            {
                try
                {
                    Bitmap b = new Bitmap(Program.Photo);                    

                    if (Effects2.Rotate != RotateFlipType.RotateNoneFlipNone)
                    {
                        b.RotateFlip(Effects2.Rotate);
                    }

                    if (Effects2.Flip != RotateFlipType.RotateNoneFlipNone)
                    {
                        b.RotateFlip(Effects2.Flip);
                    }


                    if (cropData != Rectangle.Empty)
                    {
                        Bitmap oldB = b;
                        b = Operations.Crop(b, cropData.X, cropData.Y, cropData.Width, cropData.Height);
                        oldB.Dispose();
                        oldB = null;
                    }

                    Program.Filter.Do(b);
                    //GB
                    b = Program.Effects.Do(b);

                    Effects2.Do(b);

                    WaterMark wm = new WaterMark(this.WaterMarkText, this.TextAlign, this.waterMarkFont, this.waterMarkImage, this.ImageAlign);
                    b = (Bitmap)wm.MarkImage(b);

                    if (Effects2.rounded)
                    {
                        Effects2.RoundImageTransparent(b, 50);
                    }

                    if (Effects2.dropshadow)
                    {
                        Genetibase.BasicFilters.DropShadowFilter f3 = new Genetibase.BasicFilters.DropShadowFilter();
                        b = (Bitmap)f3.ExecuteFilter(b);
                    }


                    if (Effects2.curvature != 0)
                    {
                        Genetibase.BasicFilters.FisheyeFilter f = new Genetibase.BasicFilters.FisheyeFilter();
                        f.Curvature = (float)Effects2.curvature / 100;
                        b = (Bitmap)f.ExecuteFilter(b);
                    }

                    if (Effects2.FloorReflectionFilter.DockPosition != DockStyle.None)
                    {
                        Genetibase.BasicFilters.FloorReflectionFilter f = new Genetibase.BasicFilters.FloorReflectionFilter();
                        f.AlphaEnd = Effects2.FloorReflectionFilter.AlphaEnd;
                        f.AlphaStart = Effects2.FloorReflectionFilter.AlphaStart;
                        f.DockPosition = Effects2.FloorReflectionFilter.DockPosition;
                        f.Offset = Effects2.FloorReflectionFilter.Offset;

                        b = (Bitmap)f.ExecuteFilter(b);
                    }

                    if (Effects2.BoxFilter.Angle != 0)
                    {
                        Genetibase.BasicFilters.BoxFilter f = new Genetibase.BasicFilters.BoxFilter();
                        f.DrawImageOnSides = Effects2.BoxFilter.DrawImageOnSides;
                        f.BoxStartColor = Effects2.BoxFilter.BoxStartColor;
                        f.BoxEndColor = Effects2.BoxFilter.BoxEndColor;
                        f.BoxDepth = Effects2.BoxFilter.BoxDepth;
                        f.Angle = Effects2.BoxFilter.Angle;

                        if (Extra.Enable)
                        {
                            f.BackGroundColor = Extra.BackgroundColor;
                        }

                        b = (Bitmap)f.ExecuteFilter(b);//
                    }


                    return b;
                }
                catch(Exception)
                {                    
                }                                
            }

            return null;
        }
コード例 #4
0
ファイル: Effects.cs プロジェクト: xuchuansheng/GenXSource
 public static Bitmap FishEye(Image bitmap)
 {
 	 if (Effects.curvature != 0)
     {
         Genetibase.BasicFilters.FisheyeFilter f = new Genetibase.BasicFilters.FisheyeFilter();
         f.Curvature = (float)Effects.curvature / 100;
         return (Bitmap)f.ExecuteFilter(bitmap);
     }
 	 return (Bitmap)bitmap;
 }