public SDGDraw(SDG_RenderElements els) { realRenderer = els; glyphRunner = new GlyphRunGenerator <Font>( (uf, s, f) => SDGTr.tr(realRenderer.graphics.MeasureString(s, f, PointF.Empty, StringFormat.GenericTypographic)), // measurer uf => Translate(uf) // font translator (from ufont to the template) ); }
void IController <IWFWin> .Init(IWFWin initObj, NoForm nf) { winForm = initObj.form; this.nf = nf; nf.controller = this; // Register! winForm.MouseDown += (o, e) => MouseUpDown(SDGTr.tr(e.Location), WFTr.Translate(e.Button), NoForms.Common.ButtonState.DOWN); winForm.MouseUp += (o, e) => MouseUpDown(SDGTr.tr(e.Location), WFTr.Translate(e.Button), NoForms.Common.ButtonState.UP); winForm.MouseMove += (o, e) => MouseMove(SDGTr.tr(e.Location)); winForm.KeyDown += (o, e) => KeyUpDown((NoForms.Common.Keys)e.KeyCode, NoForms.Common.ButtonState.DOWN); winForm.KeyUp += (o, e) => KeyUpDown((NoForms.Common.Keys)e.KeyCode, NoForms.Common.ButtonState.UP); winForm.KeyPress += (o, e) => KeyPress(e.KeyChar); // also the noform MouseUpDown += (a, b, c) => nf.MouseUpDown(a, b, c, true, false); MouseMove += l => nf.MouseMove(l, true, false); KeyUpDown += nf.KeyUpDown; KeyPress += nf.KeyPress; }
Brush CreateNewBrush(UBrush b) { // FIXME can use PathGradientBrush, d2d just has gradientbrush... Brush ret; if (b is USolidBrush) { // FIXME support brushProperties USolidBrush sb = b as USolidBrush; ret = new SolidBrush(SDGTr.tr(sb.color)); } else if (b is ULinearGradientBrush) { var lb = b as ULinearGradientBrush; ret = new LinearGradientBrush(SDGTr.trF(lb.point1), SDGTr.trF(lb.point2), SDGTr.tr(lb.color1), SDGTr.tr(lb.color2)); } else { throw new NotImplementedException(); } return(ret); }