public PowerPoint.Shape ApplyRectBannerEffect(BannerDirection direction, Position textPos, PowerPoint.Shape imageShape,
            string overlayColor, int transparency)
        {
            var tbInfo =
                new TextBoxes(Shapes.Range(), SlideWidth, SlideHeight)
                .GetTextBoxesInfo();
            if (tbInfo == null)
                return null;

            TextBoxes.AddMargin(tbInfo);

            PowerPoint.Shape overlayShape;
            direction = HandleAutoDirection(direction, textPos);
            switch (direction)
            {
                case BannerDirection.Horizontal:
                    overlayShape = ApplyOverlayEffect(overlayColor, transparency, 0, tbInfo.Top, SlideWidth,
                        tbInfo.Height);
                    break;
                // case BannerDirection.Vertical:
                default:
                    overlayShape = ApplyOverlayEffect(overlayColor, transparency, tbInfo.Left, 0, tbInfo.Width,
                        SlideHeight);
                    break;
            }
            ChangeName(overlayShape, EffectName.Banner);
            overlayShape.ZOrder(MsoZOrderCmd.msoSendToBack);
            if (imageShape != null)
            {
                imageShape.ZOrder(MsoZOrderCmd.msoSendToBack);
            }
            return overlayShape;
        }
 private BannerDirection HandleAutoDirection(BannerDirection dir, Position textPos)
 {
     if (dir != BannerDirection.Auto) return dir;
     switch (textPos)
     {
         case Position.Left:
         case Position.Centre:
         case Position.Right:
             return BannerDirection.Vertical;
         default:
             return BannerDirection.Horizontal;
     }
 }
Beispiel #3
0
        private BannerDirection HandleAutoDirection(BannerDirection dir, Position textPos)
        {
            if (dir != BannerDirection.Auto)
            {
                return(dir);
            }
            switch (textPos)
            {
            case Position.Left:
            case Position.Centre:
            case Position.Right:
                return(BannerDirection.Vertical);

            default:
                return(BannerDirection.Horizontal);
            }
        }
        public Shape ApplyFrostedGlassBannerEffect(BannerDirection direction, Position textPos, Shape blurImage,
                                                   string overlayColor, int transparency)
        {
            TextBoxInfo tbInfo =
                new TextBoxes(Shapes.Range(), SlideWidth, SlideHeight)
                .GetTextBoxesInfo();

            if (tbInfo == null)
            {
                return(null);
            }

            TextBoxes.AddMargin(tbInfo);

            Shape overlayShape;
            Shape blurBanner = blurImage.Duplicate()[1];

            blurBanner.Left = blurImage.Left;
            blurBanner.Top  = blurImage.Top;
            direction       = HandleAutoDirection(direction, textPos);
            switch (direction)
            {
            case BannerDirection.Horizontal:
                overlayShape = ApplyOverlayEffect(overlayColor, transparency, 0, tbInfo.Top, SlideWidth,
                                                  tbInfo.Height);
                CropPicture(blurBanner, 0, tbInfo.Top, SlideWidth, tbInfo.Height);
                break;

            // case BannerDirection.Vertical:
            default:
                overlayShape = ApplyOverlayEffect(overlayColor, transparency, tbInfo.Left, 0, tbInfo.Width,
                                                  SlideHeight);
                CropPicture(blurBanner, tbInfo.Left, 0, tbInfo.Width, SlideHeight);
                break;
            }
            ChangeName(overlayShape, EffectName.Banner);
            ChangeName(blurBanner, EffectName.Banner);
            overlayShape.ZOrder(MsoZOrderCmd.msoSendToBack);
            Utils.ShapeUtil.MoveZToJustBehind(blurBanner, overlayShape);

            Microsoft.Office.Interop.PowerPoint.ShapeRange range = Shapes.Range(new[] { blurBanner.Name, overlayShape.Name });
            Shape resultShape = range.Group();

            ChangeName(resultShape, EffectName.Banner);
            return(resultShape);
        }
        public Shape ApplyFrostedGlassBannerEffect(BannerDirection direction, Position textPos, Shape blurImage,
            string overlayColor, int transparency)
        {
            var tbInfo =
                new TextBoxes(Shapes.Range(), SlideWidth, SlideHeight)
                .GetTextBoxesInfo();
            if (tbInfo == null)
                return null;

            TextBoxes.AddMargin(tbInfo);

            Shape overlayShape;
            blurImage.Copy();
            Shape blurBanner = Shapes.Paste()[1];
            blurBanner.Left = blurImage.Left;
            blurBanner.Top = blurImage.Top;
            direction = HandleAutoDirection(direction, textPos);
            switch (direction)
            {
                case BannerDirection.Horizontal:
                    overlayShape = ApplyOverlayEffect(overlayColor, transparency, 0, tbInfo.Top, SlideWidth,
                        tbInfo.Height);
                    CropPicture(blurBanner, 0, tbInfo.Top, SlideWidth, tbInfo.Height);
                    break;
                // case BannerDirection.Vertical:
                default:
                    overlayShape = ApplyOverlayEffect(overlayColor, transparency, tbInfo.Left, 0, tbInfo.Width,
                        SlideHeight);
                    CropPicture(blurBanner, tbInfo.Left, 0, tbInfo.Width, SlideHeight);
                    break;
            }
            ChangeName(overlayShape, EffectName.Banner);
            ChangeName(blurBanner, EffectName.Banner);
            overlayShape.ZOrder(MsoZOrderCmd.msoSendToBack);
            Graphics.MoveZToJustBehind(blurBanner, overlayShape);

            var range = Shapes.Range(new[] {blurBanner.Name, overlayShape.Name});
            var resultShape = range.Group();
            ChangeName(resultShape, EffectName.Banner);
            return resultShape;
        }
Beispiel #6
0
        public PowerPoint.Shape ApplyRectBannerEffect(BannerDirection direction, Position textPos, PowerPoint.Shape imageShape,
                                                      string overlayColor, int transparency)
        {
            var tbInfo =
                new TextBoxes(Shapes.Range(), SlideWidth, SlideHeight)
                .GetTextBoxesInfo();

            if (tbInfo == null)
            {
                return(null);
            }

            TextBoxes.AddMargin(tbInfo);

            PowerPoint.Shape overlayShape;
            direction = HandleAutoDirection(direction, textPos);
            switch (direction)
            {
            case BannerDirection.Horizontal:
                overlayShape = ApplyOverlayEffect(overlayColor, transparency, 0, tbInfo.Top, SlideWidth,
                                                  tbInfo.Height);
                break;

            // case BannerDirection.Vertical:
            default:
                overlayShape = ApplyOverlayEffect(overlayColor, transparency, tbInfo.Left, 0, tbInfo.Width,
                                                  SlideHeight);
                break;
            }
            ChangeName(overlayShape, EffectName.Banner);
            overlayShape.ZOrder(MsoZOrderCmd.msoSendToBack);
            if (imageShape != null)
            {
                imageShape.ZOrder(MsoZOrderCmd.msoSendToBack);
            }
            return(overlayShape);
        }