Example #1
0
        public override void Decorate(ImageDecoratorContext context)
        {
            const int BORDER_WIDTH = 8;
            const int SHADOW_WIDTH = 4;
            DropShadowBorderDecoratorSettings settings = new DropShadowBorderDecoratorSettings(context);

            context.Image = ImageUtils.ApplyDropShadowOutside(context.Image, settings.BackgroundColor, settings.ShadowColor, SHADOW_WIDTH, BORDER_WIDTH);

            //update the margin value to reflect the border added by this decorator.
            int borderWidth  = BORDER_WIDTH * 2 + SHADOW_WIDTH;
            int borderHeight = borderWidth;

            context.BorderMargin =
                new ImageBorderMargin(borderWidth, borderHeight, new BorderCalculation(borderWidth, borderHeight));

            HideHtmlBorder(context);
        }