Example #1
0
        public GuiElementDrawCommandHandle createFillClosedLines(ClosedLoop outline, Color color, float Transparency, uint StartIndex)
        {
            ulong id;
            GuiElementDrawCommand guiElementDrawCommand = guiElementDrawCommands.createNewGuiElementDrawCommandAndIncrementId(GuiElementDrawCommand.EnumType.CLOSEDLOOPGEOMETRY, out id);

            guiElementDrawCommand.closedLoopGeometry = outline.points;

            return(new GuiElementDrawCommandHandle(id));
        }
Example #2
0
        public GuiElementDrawCommandHandle createDrawText(string text, SpatialVectorDouble signScale, Color color)
        {
            ulong id;
            GuiElementDrawCommand guiElementDrawCommand = guiElementDrawCommands.createNewGuiElementDrawCommandAndIncrementId(GuiElementDrawCommand.EnumType.LINES, out id);

            // create lineCommandInterpreter which fills the lines into the GuiElementDrawCommand
            //        lineRendererDriver which receives Hershey commands and translates it into line commands
            //        hersheyInterpreter which interprets hershey commands of the signs
            var lineCommandInterpreter            = new SoftwareGuiTextRendererLineCommandInterpreter();
            LineRendererDriver lineRendererDriver = new LineRendererDriver(lineCommandInterpreter);

            // OPTIMIZATION EXTREMELY LOW< we could cache this object >
            HersheyTextRenderer textRenderer = new HersheyTextRenderer();

            textRenderer.lineRendererDriver = lineRendererDriver;


            lineCommandInterpreter.reset();

            lineRendererDriver.scale = signScale;

            textRenderer.loadHersheyCommands(@"D:\win10host\files\github\WhiteSphereEngine\resources\engine\graphics\font\hershey");

            textRenderer.renderString(text, signScale, new SpatialVectorDouble(new double[] { 0, 0 }));

            guiElementDrawCommand.lines = lineCommandInterpreter.lines; // transfer the line command

            return(new GuiElementDrawCommandHandle(id));
        }