Exemple #1
0
 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();
 }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        public static SolidColorData data(this iBrush brush)
        {
            SolidColorBrush b = (SolidColorBrush)brush;

            return(b.data);
        }
Exemple #5
0
        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());
        }
Exemple #6
0
 void iDrawContext.drawText(string text, iFont font, Rect layoutRect, iBrush foreground, iBrush background)
 {
     drawText(text, (Font)font, ref layoutRect, foreground.data(), background.data());
 }
Exemple #7
0
 void iDrawContext.fillRectangle(Rect rect, iBrush brush) =>
 fillRectangle(ref rect, brush.data());
Exemple #8
0
 void iDrawContext.drawRectangle(Rect rect, iBrush brush, float width) =>
 drawRectangle(ref rect, width, brush.data().paletteIndex);