예제 #1
0
        private PowerPoint.Shape ApplyCircleOverlayEffect(string color, int transparency,
                                                          float left, float top, float width, float height, bool isOutline)
        {
            float radius      = (float)Math.Sqrt(width * width / 4 + height * height / 4);
            float circleLeft  = left - radius + width / 2;
            float circleTop   = top - radius + height / 2;
            float circleWidth = radius * 2;

            PowerPoint.Shape overlayShape = Shapes.AddShape(MsoAutoShapeType.msoShapeOval, circleLeft, circleTop,
                                                            circleWidth, circleWidth);
            overlayShape.Fill.Solid();
            overlayShape.Fill.ForeColor.RGB = GraphicsUtil.ConvertColorToRgb(StringUtil.GetColorFromHexValue(color));
            overlayShape.Fill.Transparency  = (float)transparency / 100;
            overlayShape.Line.ForeColor.RGB = GraphicsUtil.ConvertColorToRgb(StringUtil.GetColorFromHexValue(color));
            overlayShape.Line.Transparency  = (float)transparency / 100;
            overlayShape.Line.Weight        = 5;
            if (isOutline)
            {
                overlayShape.Fill.Visible = MsoTriState.msoFalse;
                overlayShape.Line.Visible = MsoTriState.msoTrue;
            }
            else
            {
                overlayShape.Fill.Visible = MsoTriState.msoTrue;
                overlayShape.Line.Visible = MsoTriState.msoFalse;
            }
            // as picture shape
            overlayShape.Cut();
            overlayShape      = Shapes.PasteSpecial(PowerPoint.PpPasteDataType.ppPastePNG)[1];
            overlayShape.Left = circleLeft;
            overlayShape.Top  = circleTop;
            ChangeName(overlayShape, EffectName.Overlay);
            return(overlayShape);
        }
예제 #2
0
 private void AddRectangleShape()
 {
     PowerPoint.Shape rectangleShape = Shapes.AddShape(Office.MsoAutoShapeType.msoShapeRectangle, (-SoftEdgePadding / 2 * Spotlight.defaultSoftEdges), (-SoftEdgePadding / 2 * Spotlight.defaultSoftEdges), (PowerPointPresentation.Current.SlideWidth + (SoftEdgePadding * Spotlight.defaultSoftEdges)), (PowerPointPresentation.Current.SlideHeight + (SoftEdgePadding * Spotlight.defaultSoftEdges)));
     rectangleShape.Fill.Solid();
     rectangleShape.Fill.ForeColor.RGB = ColorTranslator.ToWin32(Spotlight.defaultColor);
     rectangleShape.Fill.Transparency  = Spotlight.defaultTransparency;
     rectangleShape.Line.Visible       = Office.MsoTriState.msoFalse;
     rectangleShape.Name = "SpotlightShape1";
     rectangleShape.ZOrder(Office.MsoZOrderCmd.msoSendToBack);
 }
예제 #3
0
        public static Bitmap DisplayImage(Shape formatShape)
        {
            Shapes shapes = SyncFormatUtil.GetTemplateShapes();
            Shape  shape  = shapes.AddShape(
                Microsoft.Office.Core.MsoAutoShapeType.msoShapeRectangle, 0, 0,
                SyncFormatConstants.DisplayImageSize.Width,
                SyncFormatConstants.DisplayImageSize.Height);

            shape.Line.Visible = Microsoft.Office.Core.MsoTriState.msoFalse;
            SyncFormat(formatShape, shape);
            Bitmap image = new Bitmap(GraphicsUtil.ShapeToBitmap(shape));

            shape.Delete();
            return(image);
        }
예제 #4
0
        public override Bitmap DisplayImage(Shape formatShape)
        {
            Shapes shapes = SyncFormatUtil.GetTemplateShapes();
            Shape  shape  = shapes.AddShape(
                Microsoft.Office.Core.MsoAutoShapeType.msoShapeRectangle, 0, 0,
                SyncFormatConstants.DisplayImageSize.Width,
                SyncFormatConstants.DisplayImageSize.Height);

            shape.Line.Visible   = Microsoft.Office.Core.MsoTriState.msoFalse;
            shape.Fill.ForeColor = formatShape.Line.ForeColor;
            Bitmap image = GraphicsUtil.ShapeToBitmap(shape);

            shape.SafeDelete();
            return(image);
        }
        public PowerPoint.Shape ApplyAlbumFrameEffect(string overlayColor, int transparency)
        {
            int   halfFrameWidth = 15;
            float width          = SlideWidth - halfFrameWidth * 2;
            float height         = SlideHeight - halfFrameWidth * 2;

            PowerPoint.Shape frameShape = Shapes.AddShape(MsoAutoShapeType.msoShapeRectangle, halfFrameWidth, halfFrameWidth,
                                                          width, height);
            ChangeName(frameShape, EffectName.Overlay);
            frameShape.Fill.Transparency  = 1f;
            frameShape.Line.ForeColor.RGB = GraphicsUtil.ConvertColorToRgb(StringUtil.GetColorFromHexValue(overlayColor));
            frameShape.Line.Transparency  = (float)transparency / 100;
            frameShape.Line.Weight        = 30;
            frameShape.Line.Visible       = MsoTriState.msoTrue;
            return(frameShape);
        }
 // add overlay layer
 public PowerPoint.Shape ApplyOverlayEffect(string color, int transparency,
                                            float left = 0, float top = 0, float?width = null, float?height = null)
 {
     width  = width ?? SlideWidth;
     height = height ?? SlideHeight;
     PowerPoint.Shape overlayShape = Shapes.AddShape(MsoAutoShapeType.msoShapeRectangle, left, top,
                                                     width.Value, height.Value);
     ChangeName(overlayShape, EffectName.Overlay);
     overlayShape.Fill.Solid();
     overlayShape.Fill.ForeColor.RGB = GraphicsUtil.ConvertColorToRgb(StringUtil.GetColorFromHexValue(color));
     overlayShape.Fill.Transparency  = (float)transparency / 100;
     overlayShape.Line.ForeColor.RGB = GraphicsUtil.ConvertColorToRgb(StringUtil.GetColorFromHexValue(color));
     overlayShape.Line.Transparency  = (float)transparency / 100;
     overlayShape.Line.Weight        = 5;
     overlayShape.Line.Visible       = MsoTriState.msoFalse;
     return(overlayShape);
 }
예제 #7
0
        public static Bitmap DisplayImage(Shape formatShape)
        {
            Shapes shapes = SyncFormatUtil.GetTemplateShapes();
            Shape  shape  = shapes.AddShape(
                Microsoft.Office.Core.MsoAutoShapeType.msoShapeRectangle, 0, 0,
                SyncFormatConstants.DisplayImageSize.Width,
                SyncFormatConstants.DisplayImageSize.Height);

            shape.Line.Visible       = Microsoft.Office.Core.MsoTriState.msoFalse;
            shape.Fill.ForeColor.RGB = formatShape.TextFrame.TextRange.Font.Color.RGB;
            shape.Fill.BackColor.RGB = formatShape.TextFrame.TextRange.Font.Color.RGB;
            shape.Fill.Solid();
            Bitmap image = GraphicsUtil.ShapeToBitmap(shape);

            shape.Delete();
            return(image);
        }
        private void AddRectangleShape()
        {
            float softEdges    = EffectsLabSettings.SpotlightSoftEdges;
            Color color        = EffectsLabSettings.SpotlightColor;
            float transparency = EffectsLabSettings.SpotlightTransparency;

            PowerPoint.Shape rectangleShape = Shapes.AddShape(
                Office.MsoAutoShapeType.msoShapeRectangle,
                (-SoftEdgePadding / 2 * softEdges),
                (-SoftEdgePadding / 2 * softEdges),
                (PowerPointPresentation.Current.SlideWidth + (SoftEdgePadding * softEdges)),
                (PowerPointPresentation.Current.SlideHeight + (SoftEdgePadding * softEdges)));
            rectangleShape.Fill.Solid();
            rectangleShape.Fill.ForeColor.RGB = ColorTranslator.ToWin32(color);
            rectangleShape.Fill.Transparency  = transparency;
            rectangleShape.Line.Visible       = Office.MsoTriState.msoFalse;
            rectangleShape.Name = "SpotlightShape1";
            rectangleShape.ZOrder(Office.MsoZOrderCmd.msoSendToBack);
        }
        public PowerPoint.Shape ApplyTriangleEffect(string overlayColor1, string overlayColor2, int transparency)
        {
            var width1      = SlideHeight;
            var height1     = SlideWidth;
            var centerLeft1 = SlideWidth / 2;
            var centerTop1  = SlideHeight / 2;
            // the bigger triangle
            var triangle1 = Shapes.AddShape(MsoAutoShapeType.msoShapeIsoscelesTriangle,
                                            centerLeft1 - centerTop1, centerLeft1 + centerTop1 - SlideWidth, width1, height1);

            triangle1.Rotation = 90;
            ChangeName(triangle1, EffectName.Overlay);
            triangle1.Fill.Solid();
            triangle1.Fill.ForeColor.RGB = GraphicsUtil.ConvertColorToRgb(StringUtil.GetColorFromHexValue(overlayColor1));
            triangle1.Fill.Transparency  = (float)transparency / 100;
            triangle1.Line.Visible       = MsoTriState.msoFalse;

            var width2      = SlideHeight / 2;
            var height2     = SlideWidth / 2;
            var centerLeft2 = SlideWidth / 4 * 3;
            var centerTop2  = SlideHeight / 4 * 3;
            // the smaller triangle
            var triangle2 = Shapes.AddShape(MsoAutoShapeType.msoShapeIsoscelesTriangle,
                                            centerLeft2 + centerTop2 - SlideHeight,
                                            centerTop2 + SlideWidth / 2 - centerLeft2,
                                            width2,
                                            height2);

            triangle2.Rotation = 270;
            ChangeName(triangle2, EffectName.Overlay);
            triangle2.Fill.Solid();
            triangle2.Fill.ForeColor.RGB = GraphicsUtil.ConvertColorToRgb(StringUtil.GetColorFromHexValue(overlayColor2));
            triangle2.Fill.Transparency  = (float)transparency / 100;
            triangle2.Line.Visible       = MsoTriState.msoFalse;

            var result = Shapes.Range(new[] { triangle1.Name, triangle2.Name }).Group();

            ChangeName(result, EffectName.Overlay);
            return(result);
        }