public HistoryData(History history) { Cur = history.Current; E = history.Enable; L = history.Locked; T = history.TrackingEnabled; US = history.MaxUndoStepCount; if (history.Commands != null) { C = new List <HistoryTypeData>(); var serializer = new JsonVOSerializer(); foreach (var command in history.Commands) { HistoryTypeData data = null; var unknownCommand = command as UnknownCommand; if (unknownCommand != null) { data = new HistoryTypeData(unknownCommand.Type, unknownCommand.Data); } else if (command != null) { data = new HistoryTypeData(command.GetType().FullName, serializer.Serialize(command)); } if (data != null) { C.Add(data); } } } else { C = new List <HistoryTypeData>(); } }
internal void SetFillColor(Color color, RgbColor preview, JsonVOSerializer serializer) { Fill = preview; _fillColor = serializer.Serialize(color); }
internal void SetBorderColor(Color color, RgbColor preview, JsonVOSerializer serializer) { Stroke = preview; _borderColor = serializer.Serialize(color); }
public SvgDocument ToSvg(ICanvas canvas) { var svgDoc = new SvgDocument(); svgDoc.Width = canvas.WorkspaceWidth * canvas.ScreenXDpi / 72; svgDoc.Height = canvas.WorkspaceHeight * canvas.ScreenYDpi / 72; svgDoc.ViewBox = new RectangleF(0, 0, canvas.WorkspaceWidth, canvas.WorkspaceHeight); svgDoc.CustomAttributes.Add(new SvgVoAttribute("print-color-management-enabled", canvas.PrintColorManagementEnabled)); svgDoc.CustomAttributes.Add(new SvgVoAttribute("preview-color-management-enabled", canvas.PreviewColorManagementEnabled)); if (canvas.PreviewTargetColorSpace.HasValue) { svgDoc.CustomAttributes.Add(new SvgVoAttribute("preview-target-color-space", canvas.PreviewTargetColorSpace.Value.ToString())); } if (canvas.Tags != null) { svgDoc.CustomAttributes.Add(new SvgVoAttribute("tags", _serializer.Serialize(canvas.Tags))); } var colorManagement = canvas.GetColorManagement(true); if (colorManagement != null) { colorManagement.InitPreviewColorMap(canvas.GetColors()); _serializer.ColorManagement = colorManagement; } // Create child items foreach (var layer in canvas.Layers) { svgDoc.ChildNodes.Add(ToSvg(layer)); } return(svgDoc); }
internal void SetHorizontalLineColor(Color color, RgbColor preview, JsonVOSerializer serializer) { HorizontalLineColor = preview; _horizontalLineColor = serializer.Serialize(color); }
internal void SetVerticalLineColor(Color color, RgbColor preview, JsonVOSerializer serializer) { VerticalLineColor = preview; _verticalLineColor = serializer.Serialize(color); }
internal void SetTextColor(Color color, RgbColor preview, JsonVOSerializer serializer) { TextColor = preview; _textColor = serializer.Serialize(color); }
internal void SetAltColor(Color color, RgbColor preview, JsonVOSerializer serializer) { AltStroke = preview; _altColor = serializer.Serialize(color); }