示例#1
0
        //Deprecated
        public static void DropShadow(Bitmap img, int Offset)
        {
            Bitmap   b         = img;
            Bitmap   retBitmap = new Bitmap(img.Width + Offset, img.Height + Offset);
            Graphics g         = Graphics.FromImage(retBitmap);

            Effects2.FillGrayForDrapShadow(b, Offset);
            Effects2.RoundImageTransparent(b, 30);
            Effects2.GaussianBlur(b, 4);

            //g.DrawImage( b, Offset, Offset);
            //g.DrawImage(img,0,0 );

            g.Dispose();
            g = null;
        }
示例#2
0
        public static void FeatherImage(Image bitmap, Color featherColor)
        {
            int width  = bitmap.Width;
            int height = bitmap.Height;

            //Bitmap b = new Bitmap(width, height);
            Graphics g = Graphics.FromImage(bitmap);

            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

            Pen p = new Pen(featherColor);

            p.EndCap   = LineCap.AnchorMask;
            p.StartCap = LineCap.AnchorMask;

            int Step = 60;
            int j = 1;
            int alpha = 0;
            int x, y;

            x = Step;
            y = Step;

            for (int i = 0; i <= Step; i++)
            {
                if (alpha >= 250)
                {
                    alpha += 1;
                }
                else
                {
                    alpha += 5;
                }

                if (alpha > 255)
                {
                    alpha = 255;
                }

                p.Color = Color.FromArgb(alpha, featherColor);

                //if (!Rounded)
                g.DrawRectangle(p, x, y, width - x * 2, height - y * 2);
                //else
                //Genetibase.UI.Drawing.Grpahics.DrawRoundedRectangle(g, p,x, y, width - x * 2, height - y * 2, 30);

                j++;
                x--;
                y--;
            }

            g.Dispose();
            p.Dispose();

            g = null;
            p = null;

            if (Rounded)
            {
                Effects2.RoundImage(bitmap, 30);
            }
        }