예제 #1
0
        public static PowerPoint.Shape GenerateOverlayShape(Models.PowerPointSlide slide, PowerPoint.Shape blurShape)
        {
            PowerPoint.Shape overlayShape = null;

            if (blurShape.Type == Office.MsoShapeType.msoPicture)
            {
                overlayShape = slide.Shapes.AddShape(Office.MsoAutoShapeType.msoShapeRectangle, blurShape.Left, blurShape.Top, blurShape.Width,
                                                     blurShape.Height);
                overlayShape.Rotation = blurShape.Rotation;
            }
            else
            {
                overlayShape = EffectsLabUtil.DuplicateShapeInPlace(blurShape);
            }

            Utils.ShapeUtil.MoveZToJustInFront(overlayShape, blurShape);

            int rgb = Utils.GraphicsUtil.ConvertColorToRgb(Utils.StringUtil.GetColorFromHexValue(HexColor));

            overlayShape.Fill.Solid();
            overlayShape.Fill.ForeColor.RGB = rgb;
            overlayShape.Fill.Transparency  = Transparency;
            overlayShape.Line.ForeColor.RGB = rgb;
            overlayShape.Line.Transparency  = Transparency;
            overlayShape.Line.Visible       = Office.MsoTriState.msoFalse;

            return(overlayShape);
        }
예제 #2
0
        private static string ApplyBlurEffectShape(Models.PowerPointSlide slide, string imageFile, PowerPoint.Shape shape)
        {
            List <string> shapeNames = new List <string>();

            shapeNames.Add(shape.Name);

            if (!string.IsNullOrWhiteSpace(shape.TextFrame2.TextRange.Text))
            {
                shape.ZOrder(Office.MsoZOrderCmd.msoBringToFront);

                PowerPoint.Shape textBox = EffectsLabUtil.DuplicateShapeInPlace(shape);
                textBox.Fill.Visible = Office.MsoTriState.msoFalse;
                textBox.Line.Visible = Office.MsoTriState.msoFalse;
                Utils.ShapeUtil.MoveZToJustInFront(textBox, shape);
                shapeNames.Add(textBox.Name);
            }

            shape.TextFrame2.DeleteText();
            CropToShape.FillInShapeWithImage(slide, imageFile, shape, isInPlace: true);

            if (EffectsLabSettings.IsTintSelected)
            {
                PowerPoint.Shape overlayShape = GenerateOverlayShape(slide, shape);
                shapeNames.Add(overlayShape.Name);
            }

            if (shapeNames.Count > 1)
            {
                PowerPoint.ShapeRange subRange     = slide.Shapes.Range(shapeNames.ToArray());
                PowerPoint.Shape      groupedShape = subRange.Group();

                return(groupedShape.Name);
            }

            return(shapeNames[0]);
        }