void iDrawContext.drawGeometry(iGeometry geometry, iBrush brush, float width, iStrokeStyle strokeStyle) { switch (brush) { case SolidColorBrush solidColor: var cd = solidColor.data; sStrokeStyle ss = strokeStyle?.strokeStyle ?? defaultStrokeStyle(); strokeGeometry((iPathGeometry)geometry, cd, null, width, ref ss); return; } throw new NotImplementedException(); }
iBrush iDrawDevice.createSolidColorBrush(Vector4 color) { iBrush brush = brushesCache.lookup(color); if (null != brush) { return(brush); } brush = d2dDevice.createSolidColorBrush(ref color); brushesCache.add(color, brush); return(brush); }
protected override void createResources(IRenderDevice device) { var fonts = context.drawDevice.fontCollection; comicSans = new sFont(fonts.comicSans(eFontStyleFlags.Normal), 32); defaultSerif = new sFont(fonts.defaultSerif(eFontStyleFlags.Normal), 18); onDpiChanged(context.dpiScalingFactor); context.dpiChanged.add(this, onDpiChanged); black = context.drawDevice.createSolidBrush(ConsoleColor.Black); white = context.drawDevice.createSolidBrush(ConsoleColor.White); green = context.drawDevice.createSolidBrush(ConsoleColor.Green); background = context.drawDevice.createSolidColorBrush(backgroundColor); }
public static SolidColorData data(this iBrush brush) { SolidColorBrush b = (SolidColorBrush)brush; return(b.data); }
void iDrawContext.drawConsoleText(string text, int width, float fontSize, Vector2 position, iBrush foreground, iBrush background) { var font = getMonospaceFont(fontSize); drawConsoleText(text, width, font, position, foreground.data(), background.data()); }
void iDrawContext.drawText(string text, iFont font, Rect layoutRect, iBrush foreground, iBrush background) { drawText(text, (Font)font, ref layoutRect, foreground.data(), background.data()); }
void iDrawContext.fillRectangle(Rect rect, iBrush brush) => fillRectangle(ref rect, brush.data());
void iDrawContext.drawRectangle(Rect rect, iBrush brush, float width) => drawRectangle(ref rect, width, brush.data().paletteIndex);