Beispiel #1
0
        protected override ShapeEngine CreateShape(bool ctrlKey, bool clickedOnControlPoint, PointD prevSelPoint)
        {
            Document doc = PintaCore.Workspace.ActiveDocument;

            ShapeEngine newEngine = new EllipseEngine(doc.CurrentUserLayer, null, owner.UseAntialiasing,
                                                      BaseEditEngine.OutlineColor, BaseEditEngine.FillColor, owner.EditEngine.BrushWidth);

            AddRectanglePoints(ctrlKey, clickedOnControlPoint, newEngine, prevSelPoint);

            //Set the new shape's DashPattern option.
            newEngine.DashPattern = dash_pattern_box.comboBox.ComboBox.ActiveText;

            return(newEngine);
        }
Beispiel #2
0
        protected override ShapeEngine CreateShape (bool ctrlKey, bool clickedOnControlPoint, PointD prevSelPoint)
		{
			Document doc = PintaCore.Workspace.ActiveDocument;

			ShapeEngine newEngine = new EllipseEngine(doc.CurrentUserLayer, null, owner.UseAntialiasing,
				BaseEditEngine.OutlineColor, BaseEditEngine.FillColor, owner.EditEngine.BrushWidth);

			AddRectanglePoints(ctrlKey, clickedOnControlPoint, newEngine, prevSelPoint);

			//Set the new shape's DashPattern option.
			newEngine.DashPattern = dash_pattern_box.comboBox.ComboBox.ActiveText;

			return newEngine;
		}
Beispiel #3
0
        /// <summary>
        /// Converts the ShapeEngine instance into a new instance of a different ShapeEngine (child) type, copying the common data.
        /// </summary>
        /// <param name="newShapeType">The new ShapeEngine type to create.</param>
        /// <param name="shapeIndex">The index to insert the ShapeEngine clone into SEngines at.
        /// This ensures that the clone is as transparent as possible.</param>
        /// <returns>A new ShapeEngine instance of the specified type with the common data copied over.</returns>
        public ShapeEngine GenericClone(BaseEditEngine.ShapeTypes newShapeType, int shapeIndex)
        {
            //Remove the old ShapeEngine instance.
            BaseEditEngine.SEngines.Remove(this);

            ShapeEngine clonedEngine;

            switch (newShapeType)
            {
            case BaseEditEngine.ShapeTypes.ClosedLineCurveSeries:
                clonedEngine = new LineCurveSeriesEngine(parentLayer, DrawingLayer, newShapeType, AntiAliasing, true,
                                                         OutlineColor, FillColor, BrushWidth);

                break;

            case BaseEditEngine.ShapeTypes.Ellipse:
                clonedEngine = new EllipseEngine(parentLayer, DrawingLayer, AntiAliasing, OutlineColor, FillColor, BrushWidth);

                break;

            case BaseEditEngine.ShapeTypes.RoundedLineSeries:
                clonedEngine = new RoundedLineEngine(parentLayer, DrawingLayer, RoundedLineEditEngine.DefaultRadius,
                                                     AntiAliasing, OutlineColor, FillColor, BrushWidth);

                break;

            default:
                //Defaults to OpenLineCurveSeries.
                clonedEngine = new LineCurveSeriesEngine(parentLayer, DrawingLayer, newShapeType, AntiAliasing, false,
                                                         OutlineColor, FillColor, BrushWidth);

                break;
            }

            clonedEngine.ControlPoints = ControlPoints.Select(i => i.Clone()).ToList();

            //Don't clone the GeneratedPoints or OrganizedPoints, as they will be calculated.

            clonedEngine.DashPattern = DashPattern;

            //Add the new ShapeEngine instance at the specified index to ensure as transparent of a cloning as possible.
            BaseEditEngine.SEngines.Insert(shapeIndex, clonedEngine);

            return(clonedEngine);
        }
Beispiel #4
0
 private EllipseEngine (EllipseEngine src)
     : base (src)
 {
 }
Beispiel #5
0
 private EllipseEngine(EllipseEngine src)
     : base(src)
 {
 }