public static void Highlight <TFont, TGlyph>( this RadicalDisplay <TFont, TGlyph> self, Color color) where TFont : IFont <TGlyph> { self.Degree?.Highlight(color); self.Radicand.Highlight(color); }
public static void HighlightCharacterAt <TFont, TGlyph>( this IGlyphDisplay <TFont, TGlyph> self, MathListIndex index, Color color) where TFont : IFont <TGlyph> { if (index.SubIndexType != MathListSubIndexType.None) { throw new ArgumentException ("The subindex must be none to get the highlight a character in it.", nameof(index)); } self.Highlight(color); }
public void DrawCaret(ICanvas canvas, Structures.Color color, CaretShape shape) { if (!(Caret is CaretHandle caret)) { return; } if (!(Display.PointForIndex(TypesettingContext.Instance, InsertionIndex) is PointF cursorPosition)) { return; } cursorPosition.Y *= -1; //inverted canvas, blah blah var path = canvas.GetPath(); path.BeginRead(1); path.Foreground = color; path.MoveTo(cursorPosition.X, cursorPosition.Y); switch (shape) { case CaretShape.IBeam: ReadOnlySpan <PointF> s = stackalloc PointF[4] { new PointF(caret.Width / 16, 0), new PointF(caret.Width / 16, -caret.Height), new PointF(-caret.Width / 16, -caret.Height), new PointF(-caret.Width / 16, 0), }; foreach (var p in s) { path.LineTo(p.X + cursorPosition.X, p.Y + cursorPosition.Y); } break; case CaretShape.UpArrow: s = stackalloc PointF[4] { new PointF(caret.Width / 2, caret.Height / 4), new PointF(caret.Width / 2, caret.Height), new PointF(-caret.Width / 2, caret.Height), new PointF(-caret.Width / 2, caret.Height / 4) }; foreach (var p in s) { path.LineTo(p.X + cursorPosition.X, p.Y + cursorPosition.Y); } break; } path.CloseContour(); path.EndRead(); } }
public void DrawCaret(ICanvas canvas, Structures.Color color, CaretShape shape) { if (!ShowCaret) { return; } var cursorPosition = Display.PointForIndex(TypesettingContext.Instance, InsertionIndex) ?? Display.Position; cursorPosition.Y *= -1; //inverted canvas, blah blah var path = canvas.GetPath(); path.BeginRead(1); path.Foreground = color; path.MoveTo(cursorPosition.X, cursorPosition.Y); switch (shape) { case CaretShape.IBeam: ReadOnlySpan <PointF> s = stackalloc PointF[4] { new PointF(Font.PointSize / 2 / 16, 0), new PointF(Font.PointSize / 2 / 16, -Font.PointSize * 2 / 3), new PointF(-Font.PointSize / 2 / 16, -Font.PointSize * 2 / 3), new PointF(-Font.PointSize / 2 / 16, 0), }; foreach (var p in s) { path.LineTo(p.X + cursorPosition.X, p.Y + cursorPosition.Y); } break; case CaretShape.UpArrow: s = stackalloc PointF[4] { new PointF(Font.PointSize / 2 / 2, Font.PointSize * 2 / 3 / 4), new PointF(Font.PointSize / 2 / 2, Font.PointSize * 2 / 3), new PointF(-Font.PointSize / 2 / 2, Font.PointSize * 2 / 3), new PointF(-Font.PointSize / 2 / 2, Font.PointSize * 2 / 3 / 4) }; foreach (var p in s) { path.LineTo(p.X + cursorPosition.X, p.Y + cursorPosition.Y); } break; } path.CloseContour(); path.EndRead(); } }
public static void Highlight <TFont, TGlyph>( this IGlyphDisplay <TFont, TGlyph> self, Color color) where TFont : IFont <TGlyph> { self.TextColor = color; }
public Color(Structures.Color color, MathList innerList) : base(string.Empty) => (Colour, InnerList) = (color, innerList);
public static void Highlight <TFont, TGlyph>(this RadicalDisplay <TFont, TGlyph> self, Color color) where TFont : IFont <TGlyph> { #warning Is including Degree intended? It is not present in iosMath self.Degree.Highlight(color); self.Radicand.Highlight(color); }
public static void Highlight <TFont, TGlyph>(this IDisplay <TFont, TGlyph> display, Structures.Color color) where TFont : IFont <TGlyph> { switch (display) { case TextLineDisplay <TFont, TGlyph> text: text.Highlight(color); break; case FractionDisplay <TFont, TGlyph> frac: frac.Highlight(color); break; case RadicalDisplay <TFont, TGlyph> radical: radical.Highlight(color); break; case ListDisplay <TFont, TGlyph> list: list.Highlight(color); break; default: break; } }
public static void Highlight <TFont, TGlyph>(this FractionDisplay <TFont, TGlyph> self, Color color) where TFont : IFont <TGlyph> { self.Numerator.Highlight(color); self.Denominator.Highlight(color); }
public void FillRect(RectangleF rect, Structures.Color color) => Checker.ConsoleFillRectangle(new Rectangle((int)(rect.X + trans.X), (int)(rect.Y + trans.Y), (int)rect.Width, (int)rect.Height), color);
public void Add(TextAtom atom, Structures.Color color, int commandLength) => Add(new TextAtom.Color(atom, color, TextLength, commandLength));
public static void Highlight <TFont, TGlyph>(this ListDisplay <TFont, TGlyph> self, Color color) where TFont : IFont <TGlyph> { foreach (var display in self.Displays) { display.Highlight(color); } }
public static void HighlightCharacterAt <TFont, TGlyph>(this ListDisplay <TFont, TGlyph> self, MathListIndex index, Color color) where TFont : IFont <TGlyph> { if (index is null) { return; } if (self.Range.Contains(index.AtomIndex) && self.SubDisplayForIndex(index) is IDisplay <TFont, TGlyph> display) { if (index.SubIndexType is MathListSubIndexType.BetweenBaseAndScripts || index.SubIndexType is MathListSubIndexType.None) { display.HighlightCharacterAt(index, color); } else { // Recurse display.HighlightCharacterAt(index.SubIndex, color); } } }
public static void Highlight <TFont, TGlyph>( this InnerDisplay <TFont, TGlyph> self, Color color) where TFont : IFont <TGlyph> => self.Inner.Highlight(color);