public LineStyle2(SwfReader r, ShapeType shapeType) { this.Width = r.GetUI16(); this.StartCapStyle = (CapStyle)r.GetBits(2); this.JoinStyle = (JoinStyle)r.GetBits(2); this.HasFillFlag = r.GetBit(); this.NoHScaleFlag = r.GetBit(); this.NoVScaleFlag = r.GetBit(); this.PixelHintingFlag = r.GetBit(); r.GetBits(5); // skip this.NoClose = r.GetBit(); this.EndCapStyle = (CapStyle)r.GetBits(2); if (this.JoinStyle == JoinStyle.MiterJoin) { this.MiterLimitFactor = (float)((r.GetByte() / 0x100) + r.GetByte()); } if (this.HasFillFlag) { this.FillStyle = FillStyleArray.ParseFillStyle2(r, shapeType); } else { this.Color = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte()); } }
internal LineStyle2(SwfReader r, ShapeType shapeType) { this.Width = r.GetUI16(); this.StartCapStyle = (CapStyle)r.GetBits(2); this.JoinStyle = (JoinStyle)r.GetBits(2); this.HasFillFlag = r.GetBit(); this.NoHScaleFlag = r.GetBit(); this.NoVScaleFlag = r.GetBit(); this.PixelHintingFlag = r.GetBit(); r.GetBits(5); // skip this.NoClose = r.GetBit(); this.EndCapStyle = (CapStyle)r.GetBits(2); if (this.JoinStyle == JoinStyle.MiterJoin) { this.MiterLimitFactor = (float)((r.GetByte() / 0x100) + r.GetByte()); } if (this.HasFillFlag) { this.FillStyle = FillStyleArray.ParseFillStyle2(r, shapeType); } else { this.Color = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte()); } }
/// <ToBeCompleted></ToBeCompleted> public void CreateStyle(Design design, StyleCategory category) { if (design == null) { throw new ArgumentNullException("design"); } Style style; switch (category) { case StyleCategory.CapStyle: style = new CapStyle(GetNewStyleName(design.CapStyles)); ((CapStyle)style).CapShape = CapShape.None; ((CapStyle)style).ColorStyle = design.ColorStyles.Black; break; case StyleCategory.CharacterStyle: style = new CharacterStyle(GetNewStyleName(design.CharacterStyles)); ((CharacterStyle)style).ColorStyle = design.ColorStyles.Black; break; case StyleCategory.ColorStyle: style = new ColorStyle(GetNewStyleName(design.ColorStyles)); ((ColorStyle)style).Color = Color.Black; ((ColorStyle)style).Transparency = 0; break; case StyleCategory.FillStyle: style = new FillStyle(GetNewStyleName(design.FillStyles)); ((FillStyle)style).AdditionalColorStyle = design.ColorStyles.White; ((FillStyle)style).BaseColorStyle = design.ColorStyles.Black; ((FillStyle)style).FillMode = FillMode.Gradient; ((FillStyle)style).ImageLayout = ImageLayoutMode.Fit; break; case StyleCategory.LineStyle: style = new LineStyle(GetNewStyleName(design.LineStyles)); ((LineStyle)style).ColorStyle = design.ColorStyles.Black; ((LineStyle)style).DashCap = System.Drawing.Drawing2D.DashCap.Round; ((LineStyle)style).DashType = DashType.Solid; ((LineStyle)style).LineJoin = System.Drawing.Drawing2D.LineJoin.Round; ((LineStyle)style).LineWidth = 1; break; case StyleCategory.ParagraphStyle: style = new ParagraphStyle(GetNewStyleName(design.ParagraphStyles)); ((ParagraphStyle)style).Alignment = ContentAlignment.MiddleCenter; ((ParagraphStyle)style).Padding = new TextPadding(3); ((ParagraphStyle)style).Trimming = StringTrimming.EllipsisCharacter; ((ParagraphStyle)style).WordWrap = false; break; default: throw new NShapeUnsupportedValueException(typeof(StyleCategory), category); } ICommand cmd = new CreateStyleCommand(design, style); project.ExecuteCommand(cmd); }
/// <summary> /// LINESTYLE2 builds upon the capabilities of the LINESTYLE record by allowing the use of new types of joins /// and caps as well as scaling options and the ability to fill a stroke. /// </summary> /// <param name="InitialVersion">The version of the Swf file using this object.</param> public LineStyle2(byte InitialVersion) : base(InitialVersion) { this._startCapStyle = CapStyle.None; this._joinstyle = JoinStyle.Round; this._endCapStyle = CapStyle.None; this._color = new Rgba(this._SwfVersion); this._fillStyle = new FillStyle(this._SwfVersion); }
public MeasureLine(uint line, int process) { this.mLineBeginn = line; this.mProcess = process; this.mLineEnd = 0; this.mItemPen = new Pen(Color.Black, 1); this.mPos = MeasurePos.Left; this.mCapStyle = CapStyle.Inner; }
private MorphLineStyle ReadMorphLineStyle2(SWFDataTypeReader shapeReader) { int startwidth = shapeReader.ReadUI16(); int endwidth = shapeReader.ReadUI16(); CapStyle startCap = (CapStyle)shapeReader.ReadUBits(2); JoinStyle join = (JoinStyle)shapeReader.ReadUBits(2); bool hasFill = shapeReader.ReadBit(); bool noHScaling = shapeReader.ReadBit(); bool noVScaling = shapeReader.ReadBit(); bool hasPixelHints = shapeReader.ReadBit(); shapeReader.ReadUBits(5); // Reserved: 0 bool noClose = shapeReader.ReadBit(); CapStyle endCap = (CapStyle)shapeReader.ReadUBits(2); int?miterLimit = null; if (join == JoinStyle.Miter) { miterLimit = shapeReader.ReadUI16(); } Color? startColour = null; Color? endColour = null; MorphFillStyle fs = null; if (hasFill) { fs = this.ReadMorphFillStyle(shapeReader); } else { startColour = shapeReader.ReadRGBA(); endColour = shapeReader.ReadRGBA(); } return(new MorphLineStyle() { StartWidth = startwidth, EndWidth = endwidth, StartColour = startColour, EndColour = endColour, StartCap = startCap, EndCap = endCap, Join = join, HasFill = hasFill, NoHScaling = noHScaling, NoVScaling = noVScaling, HasPixelHints = hasPixelHints, FillStyle = fs, MiterLimit = miterLimit }); }
/// <summary> /// Get template of each attribute type /// it is used in TextRangeFindDialog. /// </summary> /// <returns></returns> public static IList <TemplateData> GetTemplate() { var boolList = new List <KeyValuePair <bool, string> >() { new KeyValuePair <bool, string>(false, "False"), new KeyValuePair <bool, string>(true, "True") }; return(new List <TemplateData> { CreateTemplateData <int>(UIA_AnimationStyleAttributeId, AnimationStyle.GetInstance()), CreateTemplateData <int>(UIA_BackgroundColorAttributeId), CreateTemplateData <int>(UIA_BulletStyleAttributeId, BulletStyle.GetInstance()), CreateTemplateData <int>(UIA_CapStyleAttributeId, CapStyle.GetInstance()), CreateTemplateData <int>(UIA_CultureAttributeId, CultureInfo.GetCultures(CultureTypes.InstalledWin32Cultures).Select(c => new KeyValuePair <int, string>(c.LCID, c.EnglishName)).ToList()), CreateTemplateData <string>(UIA_FontNameAttributeId), CreateTemplateData <double>(UIA_FontSizeAttributeId), CreateTemplateData <int>(UIA_FontWeightAttributeId, FontWeight.GetInstance()), CreateTemplateData <int>(UIA_ForegroundColorAttributeId), CreateTemplateData <int>(UIA_HorizontalTextAlignmentAttributeId, HorizontalTextAlignment.GetInstance()), CreateTemplateData <int>(UIA_IndentationFirstLineAttributeId), CreateTemplateData <int>(UIA_IndentationLeadingAttributeId), CreateTemplateData <int>(UIA_IndentationTrailingAttributeId), CreateTemplateData <bool>(UIA_IsHiddenAttributeId, boolList), CreateTemplateData <bool>(UIA_IsItalicAttributeId, boolList), CreateTemplateData <bool>(UIA_IsReadOnlyAttributeId, boolList), CreateTemplateData <bool>(UIA_IsSubscriptAttributeId, boolList), CreateTemplateData <bool>(UIA_IsSuperscriptAttributeId, boolList), CreateTemplateData <int>(UIA_MarginBottomAttributeId), CreateTemplateData <int>(UIA_MarginLeadingAttributeId), CreateTemplateData <int>(UIA_MarginTopAttributeId), CreateTemplateData <int>(UIA_MarginTrailingAttributeId), CreateTemplateData <int>(UIA_OutlineStylesAttributeId, OutlineStyle.GetInstance()), CreateTemplateData <int>(UIA_OverlineColorAttributeId), CreateTemplateData <int>(UIA_OverlineStyleAttributeId, TextDecorationLineStyle.GetInstance()), CreateTemplateData <int>(UIA_StrikethroughColorAttributeId), CreateTemplateData <int>(UIA_StrikethroughStyleAttributeId, TextDecorationLineStyle.GetInstance()), CreateTemplateData <int>(UIA_TabsAttributeId), CreateTemplateData <int>(UIA_TextFlowDirectionsAttributeId, FlowDirection.GetInstance()), CreateTemplateData <int>(UIA_UnderlineColorAttributeId), CreateTemplateData <int>(UIA_UnderlineStyleAttributeId, TextDecorationLineStyle.GetInstance()), CreateTemplateData <int>(UIA_AnnotationTypesAttributeId, AnnotationType.GetInstance()), //CreateTemplateData<int>(UIA_AnnotationObjectsAttributeId, AnimationStyles.GetInstance()), CreateTemplateData <string>(UIA_StyleNameAttributeId), CreateTemplateData <int>(UIA_StyleIdAttributeId, StyleId.GetInstance()), //CreateTemplateData<int>(UIA_LinkAttributeId, AnimationStyles.GetInstance()), CreateTemplateData <bool>(UIA_IsActiveAttributeId, boolList), CreateTemplateData <int>(UIA_SelectionActiveEndAttributeId, ActiveEnd.GetInstance()), CreateTemplateData <int>(UIA_CaretPositionAttributeId, CaretPosition.GetInstance()), CreateTemplateData <int>(UIA_CaretBidiModeAttributeId, CaretBidiMode.GetInstance()), CreateTemplateData <string>(UIA_LineSpacingAttributeId), CreateTemplateData <double>(UIA_BeforeParagraphSpacingAttributeId), CreateTemplateData <double>(UIA_AfterParagraphSpacingAttributeId), CreateTemplateData <int>(UIA_SayAsInterpretAsAttributeId, SayAsInterpretAs.GetInstance()), }); }
public MeasureBeginn(uint fileLine, string name, uint line, int process) { this.mName = name; this.mLine = line; this.mProcess = process; this.mInitialHeight = 10; //SDL layout this.mItemPen = new Pen(Color.Black, 1); this.mPos = MeasurePos.Left; this.mCapStyle = CapStyle.Inner; this.mFileLine = fileLine; }
public MeasureEnd(uint fileLine, uint line, int process) { this.mName = ""; this.mLine = line; this.mProcess = process; this.mInitialHeight = 10; this.mItemPen = new Pen(Color.Black, 1); this.mPos = MeasurePos.Left; this.mCapStyle = CapStyle.Inner; this.mFileLine = fileLine; }
public MeasureStop(uint fileLine, string gate, uint line, int process) { this.mName = ""; this.mLine = line; this.mProcess = process; this.mGate = gate; this.mItemPen = new Pen(Color.Black, 1); this.mPos = MeasurePos.Left; this.mCapStyle = CapStyle.Inner; this.mFileLine = fileLine; }
public MeasureStart(uint fileLine, string name, string gate, uint line, int process, MeasurePos placement, CapStyle style) { this.mName = name; this.mLine = line; this.mProcess = process; this.mGate = gate; this.mItemPen = new Pen(Color.Black, 1); this.mPos = placement; this.mCapStyle = style; this.mFileLine = fileLine; }
public StrokeStyle(CapStyle dashCap = CapStyle.Flat, [CanBeNull] float[] dashes = null, float dashOffset = 0, DashStyle dashStyle = DashStyle.Solid, CapStyle endCap = CapStyle.Flat, LineJoin lineJoin = LineJoin.Round, float miterLimit = 0, CapStyle startCap = CapStyle.Flat) { DashCap = dashCap; Dashes = dashes; DashOffset = dashOffset; DashStyle = dashStyle; EndCap = endCap; LineJoin = lineJoin; MiterLimit = miterLimit; StartCap = startCap; }
internal BaseStrokeContent(LottieDrawable lottieDrawable, BaseLayer layer, CapStyle cap, LineJoin join, float miterLimit, AnimatableIntegerValue opacity, AnimatableFloatValue width, List <AnimatableFloatValue> dashPattern, AnimatableFloatValue offset) { _lottieDrawable = lottieDrawable; _layer = layer; Paint.Style = Paint.PaintStyle.Stroke; Paint.StrokeCap = cap; Paint.StrokeJoin = join; Paint.StrokeMiter = miterLimit; _opacityAnimation = opacity.CreateAnimation(); _widthAnimation = width.CreateAnimation(); if (offset == null) { _dashPatternOffsetAnimation = null; } else { _dashPatternOffsetAnimation = offset.CreateAnimation(); } _dashPatternAnimations = new List <IBaseKeyframeAnimation <float?, float?> >(dashPattern.Count); _dashPatternValues = new float[dashPattern.Count]; for (var i = 0; i < dashPattern.Count; i++) { _dashPatternAnimations.Add(dashPattern[i].CreateAnimation()); } layer.AddAnimation(_opacityAnimation); layer.AddAnimation(_widthAnimation); for (var i = 0; i < _dashPatternAnimations.Count; i++) { layer.AddAnimation(_dashPatternAnimations[i]); } if (_dashPatternOffsetAnimation != null) { layer.AddAnimation(_dashPatternOffsetAnimation); } _opacityAnimation.ValueChanged += OnValueChanged; _widthAnimation.ValueChanged += OnValueChanged; for (var i = 0; i < dashPattern.Count; i++) { _dashPatternAnimations[i].ValueChanged += OnValueChanged; } if (_dashPatternOffsetAnimation != null) { _dashPatternOffsetAnimation.ValueChanged += OnValueChanged; } }
public static void DrawWorldCirclePartial(this IBrush brush, float radius, int sectionsCount, float stroke, IWorldCoordinate coord, float startAngle, float endAngle, CapStyle endCapStyle = CapStyle.Flat, CapStyle startCapStyle = CapStyle.Flat, float missingPercent = 0, IBrush bgBrush = null) { var fullAngleRange = endAngle - startAngle; var halfRange = fullAngleRange / 2f; var halfStroke = stroke / 2f; var start = Math.Max(startAngle, startAngle + halfRange * missingPercent); var end = Math.Min(endAngle, endAngle - halfRange * missingPercent); if (start > end || start < 0 || end < 0 || start > 360) { return; } using (var pg = Hud.Render.CreateGeometry()) { using (var gs = pg.Open()) { var outerVectors = ArcVectors(radius + halfStroke, coord, start, end, sectionsCount); var innerVectors = ArcVectors(radius - halfStroke, coord, start, end, sectionsCount); gs.BeginFigure(outerVectors.First(), FigureBegin.Filled); foreach (var v in outerVectors.Skip(1)) { gs.AddLine(v); } //TODO: if rounded cap, add half circle innerVectors.Reverse(); foreach (var v in innerVectors) { gs.AddLine(v); } //TODO: if rounded cap, add half circle gs.EndFigure(FigureEnd.Closed); gs.Close(); if (bgBrush != null) { bgBrush.DrawGeometry(pg); } brush.DrawGeometry(pg); } } }
static EndType ToEndType(this CapStyle capStyle) { switch (capStyle) { case CapStyle.Square: return(EndType.etOpenSquare); case CapStyle.Round: return(EndType.etOpenRound); default: return(EndType.etOpenButt); } }
public override void DrawLine(gdi.Color c, float width, PointF p1, PointF p2, bool capStart = false, bool capEnd = false) { using (Brush b = new SolidColorBrush(renderTarget, c.ToColor4())) { CapStyle start = capStart ? CapStyle.Triangle : CapStyle.Flat; CapStyle end = capEnd ? CapStyle.Triangle : CapStyle.Flat; StrokeStyle style = new StrokeStyle(factory, new StrokeStyleProperties() { StartCap = start, EndCap = end }); renderTarget.DrawLine(p1.ToVector(), p2.ToVector(), b, width, style); style.Dispose(); } }
private LineStyle ReadLineStyle2(SWFDataTypeReader shapeReader, Tag format) { int width = shapeReader.ReadUI16(); CapStyle startCap = (CapStyle)shapeReader.ReadUBits(2); JoinStyle join = (JoinStyle)shapeReader.ReadUBits(2); bool hasFill = shapeReader.ReadBit(); bool noHScaling = shapeReader.ReadBit(); bool noVScaling = shapeReader.ReadBit(); bool hasPixelHints = shapeReader.ReadBit(); shapeReader.ReadUBits(5); /* Reserved: 0 */ bool noClose = shapeReader.ReadBit(); CapStyle endCap = (CapStyle)shapeReader.ReadUBits(2); int?miterLimit = null; if (join == JoinStyle.Miter) { miterLimit = shapeReader.ReadUI16(); } Color? c = null; FillStyle fs = null; if (hasFill) { fs = this.ReadFillStyle(shapeReader, format); } else { c = shapeReader.ReadRGBA(); } return(new LineStyle() { Width = width, StartCap = startCap, EndCap = endCap, Join = join, HasFill = hasFill, NoHScaling = noHScaling, NoVScaling = noVScaling, HasPixelHints = hasPixelHints, Colour = c, FillStyle = fs, MiterLimit = miterLimit }); }
public StrokeStyleProperties( CapStyle startCap = CapStyle.Flat, CapStyle endCap = CapStyle.Flat, CapStyle dashCap = CapStyle.Flat, LineJoin lineJoin = LineJoin.Miter, float miterLimit = 0.0f, DashStyle dashStyle = DashStyle.Solid, float dashOffset = 0.0f) { StartCap = startCap; EndCap = endCap; DashCap = dashCap; LineJoin = lineJoin; MiterLimit = miterLimit; DashStyle = dashStyle; DashOffset = dashOffset; }
internal void SetEndCap(CapStyle v) { var ss = (StrokeType)ST & ~StrokeType.EC_Triangle; if (v == CapStyle.Round) { ss |= StrokeType.EC_Round; } else if (v == CapStyle.Square) { ss |= StrokeType.EC_Square; } else if (v == CapStyle.Triangle) { ss |= StrokeType.EC_Triangle; } ST = (byte)ss; }
/// <summary> /// Parses this object out of a stream /// </summary> /// <param name="input">The input stream.</param> public override void Parse(Stream input) { BinaryReader br = new BinaryReader(input); this._startWidth = br.ReadUInt16(); this._endWidth = br.ReadUInt16(); BitStream bits = new BitStream(input); this._startCapStyle = (CapStyle)(Convert.ToByte(bits.GetBits(2))); this._joinstyle = (JoinStyle)(Convert.ToByte(bits.GetBits(2))); this._hasFillFlag = (0 != bits.GetBits(1) ? true : false); this._noHScale = (0 != bits.GetBits(1) ? true : false); this._noVScale = (0 != bits.GetBits(1) ? true : false); this._pixelHinting = (0 != bits.GetBits(1) ? true : false); bits.GetBits(5); // reserved must be null this._noClose = (0 != bits.GetBits(1) ? true : false); this._endCapStyle = (CapStyle)bits.GetBits(2); if (this._joinstyle.Equals(JoinStyle.Miter)) { this._miterLimtiFactor = br.ReadUInt16(); } if (!this._hasFillFlag) { this._startColor.Parse(input); this._endColor.Parse(input); } if (this._hasFillFlag) { //bits.Reset(); this._fillStyle.Parse(input); } }
internal void SetDashCap(CapStyle v) { var ss = (StrokeType)ST & ~StrokeType.DC_Triangle; var st = (StrokeType)ST & StrokeType.Filled; if (st == StrokeType.Dotted && v == CapStyle.Flat) { ss |= StrokeType.DC_Square; } else if (v == CapStyle.Round) { ss |= StrokeType.DC_Round; } else if (v == CapStyle.Square) { ss |= StrokeType.DC_Square; } else if (v == CapStyle.Triangle) { ss |= StrokeType.DC_Triangle; } ST = (byte)ss; }
public static extern Status XSetLineAttributes(IntPtr display, IntPtr gc, uint line_width, LineStyle line_style, CapStyle cap_style, JoinStyle join_style);
/// <summary> /// Initializes a new instance of the <see cref="InkAnnotation" /> class. /// </summary> /// <param name="Links">Link to the document..</param> /// <param name="Color">Color of the annotation..</param> /// <param name="Contents">Get the annotation content..</param> /// <param name="Modified">The date and time when the annotation was last modified..</param> /// <param name="Id">Gets ID of the annotation..</param> /// <param name="Flags">Gets Flags of the annotation..</param> /// <param name="Name">Gets Name of the annotation..</param> /// <param name="Rect">Gets Rect of the annotation..</param> /// <param name="PageIndex">Gets PageIndex of the annotation..</param> /// <param name="ZIndex">Gets ZIndex of the annotation..</param> /// <param name="HorizontalAlignment">Gets HorizontalAlignment of the annotation..</param> /// <param name="VerticalAlignment">Gets VerticalAlignment of the annotation..</param> /// <param name="CreationDate">The date and time when the annotation was created..</param> /// <param name="Subject">Get the annotation subject..</param> /// <param name="Title">Get the annotation title..</param> /// <param name="RichText">Get the annotation RichText..</param> /// <param name="InkList">Gets or sets list of gestures that are independent lines which are represented by Point[] arrays..</param> /// <param name="CapStyle">Style of ink annotation line endings..</param> public InkAnnotation(List <Link> Links = default(List <Link>), Color Color = default(Color), string Contents = default(string), string Modified = default(string), string Id = default(string), List <AnnotationFlags> Flags = default(List <AnnotationFlags>), string Name = default(string), Rectangle Rect = default(Rectangle), int?PageIndex = default(int?), int?ZIndex = default(int?), HorizontalAlignment HorizontalAlignment = default(HorizontalAlignment), VerticalAlignment VerticalAlignment = default(VerticalAlignment), string CreationDate = default(string), string Subject = default(string), string Title = default(string), string RichText = default(string), List <List <Point> > InkList = default(List <List <Point> >), CapStyle CapStyle = default(CapStyle)) { this.Links = Links; this.Color = Color; this.Contents = Contents; this.Modified = Modified; this.Id = Id; this.Flags = Flags; this.Name = Name; this.Rect = Rect; this.PageIndex = PageIndex; this.ZIndex = ZIndex; this.HorizontalAlignment = HorizontalAlignment; this.VerticalAlignment = VerticalAlignment; this.CreationDate = CreationDate; this.Subject = Subject; this.Title = Title; this.RichText = RichText; this.InkList = InkList; this.CapStyle = CapStyle; }
private List <TextAttributeViewModel> GetTextRangeAttributeKeyValuePair(TextRange tr, KeyValuePair <int, string> kv, bool collapse) { List <TextAttributeViewModel> list = new List <TextAttributeViewModel>(); dynamic value = tr.GetAttributeValue(kv.Key); switch (kv.Key) { case TextAttributeType.UIA_AnimationStyleAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, AnimationStyle.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_BackgroundColorAttributeId: case TextAttributeType.UIA_ForegroundColorAttributeId: case TextAttributeType.UIA_OverlineColorAttributeId: case TextAttributeType.UIA_StrikethroughColorAttributeId: case TextAttributeType.UIA_UnderlineColorAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, string.Format("#{0:X8}", value))); } break; case TextAttributeType.UIA_BulletStyleAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, BulletStyle.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_CapStyleAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, CapStyle.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_CultureAttributeId: if (value is int culture) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, Invariant($"{CultureInfo.GetCultureInfo(culture).EnglishName} ({culture})"))); } break; case TextAttributeType.UIA_StyleIdAttributeId: case TextAttributeType.UIA_SayAsInterpretAsAttributeId: // VT_I4 if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, SayAsInterpretAs.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_FontNameAttributeId: case TextAttributeType.UIA_StyleNameAttributeId: case TextAttributeType.UIA_LineSpacingAttributeId: // VT_BSTR if (value is string) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, value)); } break; case TextAttributeType.UIA_FontSizeAttributeId: case TextAttributeType.UIA_IndentationFirstLineAttributeId: case TextAttributeType.UIA_IndentationLeadingAttributeId: case TextAttributeType.UIA_IndentationTrailingAttributeId: case TextAttributeType.UIA_MarginBottomAttributeId: case TextAttributeType.UIA_MarginLeadingAttributeId: case TextAttributeType.UIA_MarginTopAttributeId: case TextAttributeType.UIA_MarginTrailingAttributeId: case TextAttributeType.UIA_BeforeParagraphSpacingAttributeId: case TextAttributeType.UIA_AfterParagraphSpacingAttributeId: // VT_R8 if (value is double || value is long) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, value.ToString())); } break; case TextAttributeType.UIA_FontWeightAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, Axe.Windows.Desktop.Styles.FontWeight.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_HorizontalTextAlignmentAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, Axe.Windows.Desktop.Styles.FontWeight.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_IsHiddenAttributeId: case TextAttributeType.UIA_IsItalicAttributeId: case TextAttributeType.UIA_IsReadOnlyAttributeId: case TextAttributeType.UIA_IsSubscriptAttributeId: case TextAttributeType.UIA_IsSuperscriptAttributeId: case TextAttributeType.UIA_IsActiveAttributeId: if (value is bool) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, value.ToString())); } break; case TextAttributeType.UIA_OutlineStylesAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, OutlineStyle.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_OverlineStyleAttributeId: case TextAttributeType.UIA_StrikethroughStyleAttributeId: case TextAttributeType.UIA_UnderlineStyleAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, TextDecorationLineStyle.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_TabsAttributeId: var txt = ConvertArrayToString(value); if (txt != null) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, txt)); } break; case TextAttributeType.UIA_TextFlowDirectionsAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, Axe.Windows.Desktop.Styles.FlowDirection.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_AnnotationTypesAttributeId: StringBuilder sb = new StringBuilder(); if (value is double) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, AnnotationType.GetInstance().GetNameById((int)value))); } else if (value is Array arr) { if (collapse && arr.Length > 0) // collapse the array into a single row { var count = new Dictionary <string, int>(); foreach (var val in arr) { var key = AnnotationType.GetInstance().GetNameById((int)val); if (count.ContainsKey(key)) { count[key]++; } else { count[key] = 1; } } StringBuilder strBuild = new StringBuilder(); foreach (var item in count) { strBuild.Append(Invariant($"{item.Key}: {item.Value}, ")); } strBuild.Length -= 2; //remove final , and <space> list.Add(new TextAttributeViewModel(kv.Key, kv.Value, strBuild.ToString())); } else // create a row for each array value { if (arr.Length > 0) { for (int i = 0; i < arr.Length; i++) { list.Add(new TextAttributeViewModel(kv.Key, string.Format(CultureInfo.InvariantCulture, "{0}[{1}]", kv.Value, i), AnnotationType.GetInstance().GetNameById((int)arr.GetValue(i)))); } } } } break; case TextAttributeType.UIA_SelectionActiveEndAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, ActiveEnd.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_CaretPositionAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, CaretPosition.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_CaretBidiModeAttributeId: if (value is int) { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, CaretBidiMode.GetInstance().GetNameById(value))); } break; case TextAttributeType.UIA_AnnotationObjectsAttributeId: if (value is IUIAutomationElementArray) { IUIAutomationElementArray arr = value; if (arr.Length > 0) { for (int i = 0; i < arr.Length; i++) { list.Add(new TextAttributeViewModel(kv.Key, string.Format(CultureInfo.InvariantCulture, Resources.TextRangeViewModel_GetTextRangeAttributeKeyValuePair_AnnotationObjects_0, i), new DesktopElement((IUIAutomationElement)arr.GetElement(i)))); } } } break; case TextAttributeType.UIA_LinkAttributeId: // do nothing for now until it is shown as necessary information. //try //{ // IUIAutomationTextRange lnk = Marshal.GetObjectForIUnknown(value) as IUIAutomationTextRange; // list.Add(new TextAttributeViewModel(kv.Value, new TextRangeViewModel(new TextRange(lnk)))); //} //catch (Exception e) //{ // e.ReportException(); //} break; default: // need to make a decision for these Attributes since it return Object. if (value.GetType().Name != "__ComObject") { list.Add(new TextAttributeViewModel(kv.Key, kv.Value, value)); } break; } return(list); }
public static void Draw(this IBrush brush, float radius, int sectionsCount, float stroke, IWorldCoordinate coord, float startAngle, float endAngle, CapStyle endCapStyle = CapStyle.Flat, CapStyle startCapStyle = CapStyle.Flat, float missingPercent = 0, IBrush bgBrush = null) { var fullAngleRange = endAngle - startAngle; var halfRange = fullAngleRange / 2f; var angleStep = fullAngleRange / sectionsCount; var halfStroke = stroke / 2f; var start = Math.Max(startAngle, startAngle + halfRange * missingPercent); var end = Math.Min(endAngle, endAngle - halfRange * missingPercent); if (start > end || start < 0 || end < 0 || start > 360) { return; } using (var pg = Hud.Render.CreateGeometry()) { using (var gs = pg.Open()) { var started = false; var outerVectors = new List <Vector2>(); var innerVectors = new List <Vector2>(); for (var angle = start; angle <= end; angle += angleStep) { if (angle + angleStep > end) //if it's the last step, round the end { angle = end; } //convert to radiant for ease of use, and set top == 0f, counter clockwise up to 360. var radians = (angle - 135f) * Math.PI / 180.0f; var cos = (float)Math.Cos(radians); var sin = (float)Math.Sin(radians); //outer point var mx = (radius + halfStroke) * cos; var my = (radius + halfStroke) * sin; var vector = coord.ToVector2(mx, my, 0); if (started) { } if (!started) { started = true; gs.BeginFigure(vector, FigureBegin.Filled); } outerVectors.Add(vector); //inner point, store for later use var mx2 = (radius - halfStroke) * cos; var my2 = (radius - halfStroke) * sin; vector = coord.ToVector2(mx2, my2, 0); innerVectors.Add(vector); } foreach (var v in outerVectors.Skip(1)) { gs.AddLine(v); } //TODO: if rounded cap, add half circle innerVectors.Reverse(); foreach (var v in innerVectors) { gs.AddLine(v); } //TODO: if rounded cap, add half circle gs.EndFigure(FigureEnd.Closed); gs.Close(); if (bgBrush != null) { bgBrush.DrawGeometry(pg); } brush.DrawGeometry(pg); } } }
public MeasureEnd(uint fileLine, string name, uint line, int process, MeasurePos placement, CapStyle style) { this.mName = name; this.mLine = line; this.mProcess = process; this.mInitialHeight = 10; this.mItemPen = new Pen(Color.Black, 1); this.mPos = placement; this.mCapStyle = style; this.mFileLine = fileLine; }
// Registers entity types for styles, designs, projectData, templates and diagramControllers // with the cache. private void RegisterBaseLibraryTypes(bool create) { int version; // When creating a repository without a valid version, we use the last supported save version. if (create && repository.Version <= 0) { repository.Version = LastSupportedSaveVersion; } version = repository.Version; // repository.AddEntityType(new EntityType(CapStyle.EntityTypeName, EntityCategory.Style, version, () => new CapStyle(), CapStyle.GetPropertyDefinitions(version))); repository.AddEntityType(new EntityType(CharacterStyle.EntityTypeName, EntityCategory.Style, version, () => new CharacterStyle(), CharacterStyle.GetPropertyDefinitions(version))); repository.AddEntityType(new EntityType(ColorStyle.EntityTypeName, EntityCategory.Style, version, () => new ColorStyle(), ColorStyle.GetPropertyDefinitions(version))); repository.AddEntityType(new EntityType(FillStyle.EntityTypeName, EntityCategory.Style, version, () => new FillStyle(), FillStyle.GetPropertyDefinitions(version))); repository.AddEntityType(new EntityType(LineStyle.EntityTypeName, EntityCategory.Style, version, () => new LineStyle(), LineStyle.GetPropertyDefinitions(version))); repository.AddEntityType(new EntityType(ParagraphStyle.EntityTypeName, EntityCategory.Style, version, () => new ParagraphStyle(), ParagraphStyle.GetPropertyDefinitions(version))); repository.AddEntityType(new EntityType(Design.EntityTypeName, EntityCategory.Design, version, () => new Design(), Design.GetPropertyDefinitions(version))); repository.AddEntityType(new EntityType(ProjectSettings.EntityTypeName, EntityCategory.ProjectSettings, version, () => new ProjectSettings(), ProjectSettings.GetPropertyDefinitions(version))); repository.AddEntityType(new EntityType(Template.EntityTypeName, EntityCategory.Template, version, () => new Template(), Template.GetPropertyDefinitions(version))); repository.AddEntityType(new EntityType(Diagram.EntityTypeName, EntityCategory.Diagram, version, () => new Diagram(""), Diagram.GetPropertyDefinitions(version))); // Register ModelMapping types // Create mandatory Model type repository.AddEntityType(new EntityType(Model.EntityTypeName, EntityCategory.Model, version, () => new Model(), Model.GetPropertyDefinitions(version))); // Register mandatory ModelMapping types repository.AddEntityType(new EntityType(NumericModelMapping.EntityTypeName, EntityCategory.ModelMapping, version, () => new NumericModelMapping(), NumericModelMapping.GetPropertyDefinitions(version))); repository.AddEntityType(new EntityType(FormatModelMapping.EntityTypeName, EntityCategory.ModelMapping, version, () => new FormatModelMapping(), FormatModelMapping.GetPropertyDefinitions(version))); repository.AddEntityType(new EntityType(StyleModelMapping.EntityTypeName, EntityCategory.ModelMapping, version, () => new StyleModelMapping(), StyleModelMapping.GetPropertyDefinitions(version))); // // Create the mandatory shape types initializingLibrary = new Library(GetType().Assembly); ((IRegistrar)this).RegisterLibrary("Core", LastSupportedSaveVersion); ShapeType groupShapeType = new ShapeType( "ShapeGroup", "Core", "Core", ShapeGroup.CreateInstance, ShapeGroup.GetPropertyDefinitions, false); ((IRegistrar)this).RegisterShapeType(groupShapeType); // Create mandatory model object types ModelObjectType genericModelObjectType = new GenericModelObjectType( "GenericModelObject", "Core", "Core", GenericModelObject.CreateInstance, GenericModelObject.GetPropertyDefinitions, 4); ((IRegistrar)this).RegisterModelObjectType(genericModelObjectType); initializingLibrary = null; // // Register static model entity types foreach (ModelObjectType mot in modelObjectTypes) { RegisterModelObjectEntityType(mot, create); } // Register static shape entity types foreach (ShapeType st in shapeTypes) { RegisterShapeEntityType(st, create); } }
/// <summary> /// Initializes a new instance of the <see cref="InkAnnotation" /> class. /// </summary> /// <param name="Links">Link to the document.</param> /// <param name="Color">Color of the annotation.</param> /// <param name="Contents">Get the annotation content.</param> /// <param name="Modified">The date and time when the annotation was last modified.</param> /// <param name="Id">Gets ID of the annotation.</param> /// <param name="Flags">Gets Flags of the annotation.</param> /// <param name="Name">Gets Name of the annotation.</param> /// <param name="Rect">Gets Rect of the annotation. (required)</param> /// <param name="PageIndex">Gets PageIndex of the annotation.</param> /// <param name="ZIndex">Gets ZIndex of the annotation.</param> /// <param name="HorizontalAlignment">Gets HorizontalAlignment of the annotation.</param> /// <param name="VerticalAlignment">Gets VerticalAlignment of the annotation.</param> /// <param name="CreationDate">The date and time when the annotation was created.</param> /// <param name="Subject">Get the annotation subject.</param> /// <param name="Title">Get the annotation title.</param> /// <param name="RichText">Get the annotation RichText.</param> /// <param name="InkList">Gets or sets list of gestures that are independent lines which are represented by Point[] arrays.</param> /// <param name="CapStyle">Style of ink annotation line endings.</param> public InkAnnotation(List <Link> Links = default(List <Link>), Color Color = default(Color), string Contents = default(string), string Modified = default(string), string Id = default(string), List <AnnotationFlags> Flags = default(List <AnnotationFlags>), string Name = default(string), Rectangle Rect = default(Rectangle), int?PageIndex = default(int?), int?ZIndex = default(int?), HorizontalAlignment HorizontalAlignment = default(HorizontalAlignment), VerticalAlignment VerticalAlignment = default(VerticalAlignment), string CreationDate = default(string), string Subject = default(string), string Title = default(string), string RichText = default(string), List <List <Point> > InkList = default(List <List <Point> >), CapStyle CapStyle = default(CapStyle)) { // to ensure "Rect" is required (not null) if (Rect == null) { throw new InvalidDataException("Rect is a required property for InkAnnotation and cannot be null"); } else { this.Rect = Rect; } this.Links = Links; this.Color = Color; this.Contents = Contents; this.Modified = Modified; this.Id = Id; this.Flags = Flags; this.Name = Name; this.PageIndex = PageIndex; this.ZIndex = ZIndex; this.HorizontalAlignment = HorizontalAlignment; this.VerticalAlignment = VerticalAlignment; this.CreationDate = CreationDate; this.Subject = Subject; this.Title = Title; this.RichText = RichText; this.InkList = InkList; this.CapStyle = CapStyle; }
/// <summary> /// Assigns values from another source. /// </summary> /// <param name="source">Source to assign from.</param> public void Assign(CapSettings source) { Width = source.Width; Height = source.Height; Style = source.Style; }
public InterpretResult addMeasureLineBeginn(uint fileLine, uint line, int process, MeasurePos placement, CapStyle style) { if (process >= processes.Count) return InterpretResult.InstanceNotFound; IEnumerator enumerator = lines.GetEnumerator(); for(uint i=0;i<lines.Count;i++){ enumerator.MoveNext(); if ( enumerator.Current is MeasureLine) if((((MeasureLine) enumerator.Current).LineEnd==0)&&(((MeasureLine) enumerator.Current).Process == process)) return InterpretResult.LineAllreadyExists; } lines.Add(new MeasureLine(line+1, style, process, placement)); return InterpretResult.Ok; }
/// <summary> /// Borders the cap style. /// </summary> /// <param name="value">The value.</param> /// <returns>RadarDatasetBuilder.</returns> public RadarDatasetBuilder BorderCapStyle(CapStyle value) { Dataset.BorderCapStyle = value; return(this); }
public InterpretResult addMeasureStop(uint fileLine, string processName, uint line, string gate, string name, MeasurePos placement, CapStyle style) { Process process; IEnumerator enumerator = processes.GetEnumerator(); bool instanceFound = false; for(int i=0;i<processes.Count;i++){ enumerator.MoveNext(); process = (Process) enumerator.Current; if(process.ProcessName == processName){ items.Add(new MeasureStop(fileLine, name, gate, line, i,placement, style)); instanceFound = true; break; } } if (instanceFound==false) return InterpretResult.InstanceNotFound; mLines = Math.Max(mLines, line); return InterpretResult.Ok; }
public MeasureLine(uint line, CapStyle style, int process, MeasurePos placement) { this.mLineBeginn = line; this.mProcess = process; this.mLineEnd = 0; this.mItemPen = new Pen(Color.Black, 1); this.mPos = placement; this.mCapStyle = style; }
public static void RepertoryImage(Graphics drawDestination, MeasurePos pos, CapStyle style) { float[] pattern = {4f,4f}; Pen rPen = new Pen(Color.Black); PointF[] capPolygon = new PointF[3]; StringFormat itemStringFormat = new StringFormat(); rPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom; rPen.DashPattern = pattern; if (pos == MeasurePos.Left){ itemStringFormat.Alignment = StringAlignment.Near; itemStringFormat.LineAlignment = StringAlignment.Far; drawDestination.DrawLine(Pens.DarkGray,70,5,70,75); if (style == CapStyle.Inner){ RectangleF itemBox = new RectangleF(21, 50, 49, 10); drawDestination.DrawLine(rPen,10,60,70,60); capPolygon[0] = new PointF(15, 59); capPolygon[1] = new PointF(10, 54); capPolygon[2] = new PointF(20, 54); drawDestination.DrawPolygon(Pens.Black,capPolygon); drawDestination.DrawLine(rPen,15,40,15,54); drawDestination.DrawEllipse(Pens.Black, new RectangleF(10,30,10,10)); drawDestination.DrawString("Measure",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat); itemBox = new RectangleF(22, 30, 48, 10); drawDestination.DrawString("g",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat); } else{ RectangleF itemBox = new RectangleF(21, 50, 49, 10); drawDestination.DrawLine(rPen,10,60,70,60); capPolygon[0] = new PointF(15, 61); capPolygon[1] = new PointF(10, 66); capPolygon[2] = new PointF(20, 66); drawDestination.DrawPolygon(Pens.Black,capPolygon); drawDestination.DrawLine(rPen,15,40,15,60); drawDestination.DrawEllipse(Pens.Black, new RectangleF(10,30,10,10)); drawDestination.DrawString("Measure",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat); itemBox = new RectangleF(22, 30, 48, 10); drawDestination.DrawString("g",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat); } } else{ itemStringFormat.Alignment = StringAlignment.Near; itemStringFormat.LineAlignment = StringAlignment.Far; drawDestination.DrawLine(Pens.DarkGray,10,5,10,75); if (style == CapStyle.Inner){ RectangleF itemBox = new RectangleF(10, 50, 50, 10); drawDestination.DrawLine(rPen,10,60,70,60); capPolygon[0] = new PointF(65, 59); capPolygon[1] = new PointF(70, 54); capPolygon[2] = new PointF(60, 54); drawDestination.DrawPolygon(Pens.Black,capPolygon); drawDestination.DrawLine(rPen,65,40,65,54); drawDestination.DrawEllipse(Pens.Black, new RectangleF(60,30,10,10)); drawDestination.DrawString("Measure",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat); itemStringFormat.Alignment = StringAlignment.Far; itemBox = new RectangleF(20, 30, 40, 10); drawDestination.DrawString("g",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat); } else{ RectangleF itemBox = new RectangleF(10, 50, 50, 10); drawDestination.DrawLine(rPen,10,60,70,60); capPolygon[0] = new PointF(65, 61); capPolygon[1] = new PointF(70, 66); capPolygon[2] = new PointF(60, 66); drawDestination.DrawPolygon(Pens.Black,capPolygon); drawDestination.DrawLine(rPen,65,40,65,60); drawDestination.DrawEllipse(Pens.Black, new RectangleF(60,30,10,10)); drawDestination.DrawString("Measure",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat); itemStringFormat.Alignment = StringAlignment.Far; itemBox = new RectangleF(20, 30, 40, 10); drawDestination.DrawString("g",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat); } } rPen.Dispose(); itemStringFormat.Dispose(); }
public MeasureBeginn(uint fileLine, uint line, int process, string placement) { this.mName = ""; this.mLine = line; this.mProcess = process; this.mInitialHeight = 10; this.mItemPen = new Pen(Color.Black, 1); this.mPlacement = CalcPlacement(placement); this.mCapStyle = CapStyle.Inner; this.mFileLine = fileLine; }