コード例 #1
0
ファイル: ExprWPF.cs プロジェクト: shayan-taheri/StarPad
        static public Geometry ComputeGeometry(Expr e, double fsize, out Rct nombbox)
        {
            EDrawingContext edc = new EDrawingContext(fsize, null, Colors.Black);
            EWPF            us  = new EWPF(false);
            Box             b   = us.Compose(e);

            b.Measure(edc);
            nombbox = b.nombbox;
            return(b.ComputeGeometry(edc));
        }
コード例 #2
0
ファイル: ExprWPF.cs プロジェクト: shayan-taheri/StarPad
        /// <summary>
        /// Note that the y component of the point where returns is the math axis, midway between the baseline and the x-height.
        /// </summary>
        /// <param name="fsize">Em-height of font to use. (This is essentially the font size.)</param>
        /// <param name="where">Note that the y component of the point this returns is the math axis, midway between the baseline and the x-height.</param>
        /// <param name="showinvisibles">Whether to draw parentheses indicating function application slightly darker</param>
        /// <returns>nominal bounding box of resulting typeset as drawn</returns>
        // TJC:
        static public BoxRct Draw(Expr e, double fsize, DrawingContext dc, Color color, Func <Rct, EDrawingContext, Pt> where, bool showinvisibles)
        {
            EDrawingContext edc = new EDrawingContext(fsize, dc, color);
            EWPF            us  = new EWPF(showinvisibles);

            edc.Brush.Opacity = Opacity; // TJC: support opacity change
            Box b = us.Compose(e);

            b.Measure(edc);
            Pt loc = where (b.nombbox, edc);

            b.Draw(edc, loc);
            // TJC:
            return(new BoxRct(b, b.nombbox + (Vec)loc));
        }