Beispiel #1
0
        void RenderSingleCharWithMiniAgg(Typeface typeface, char testChar, float sizeInPoint)
        {
            //---------------
            //set up vinfo
            UI.DebugGlyphVisualizerInfoView vinfo = debugGlyphVisualizer.VisualizeInfoView;

            if (vinfo == null)
            {
                vinfo = new UI.DebugGlyphVisualizerInfoView();
                vinfo.SetTreeView(glyphContourAnalysisOptionsUserControl1.DebugTreeView);
                vinfo.SetFlushOutputHander(() =>
                {
                    painter.SetOrigin(0, 0);
                    //6. use this util to copy image from Agg actual image to System.Drawing.Bitmap
                    PixelFarm.Agg.Imaging.BitmapHelper.CopyToGdiPlusBitmapSameSize(destImg, winBmp);
                    //---------------
                    //7. just render our bitmap
                    g.Clear(Color.White);
                    g.DrawImage(winBmp, new Point(30, 100));
                });
                debugGlyphVisualizer.VisualizeInfoView = vinfo;
            }

            //---------------
            //we use the debugGlyphVisualize the render it
            this.debugGlyphVisualizer.SetFont(typeface, sizeInPoint);
            debugGlyphVisualizer.CanvasPainter   = painter;
            debugGlyphVisualizer.UseLcdTechnique = _contourAnalysisOpts.LcdTechnique;
            debugGlyphVisualizer.FillBackGround  = _glyphRenderOptions.FillBackground;
            debugGlyphVisualizer.DrawBorder      = _glyphRenderOptions.DrawBorder;

            debugGlyphVisualizer.ShowTess = _contourAnalysisOpts.ShowTess;
            debugGlyphVisualizer.WalkTrianglesAndEdges = _contourAnalysisOpts.ShowTriangle;
            debugGlyphVisualizer.DrawEndLineHub        = _contourAnalysisOpts.DrawLineHubConn;
            debugGlyphVisualizer.DrawPerpendicularLine = _contourAnalysisOpts.DrawPerpendicularLine;
            debugGlyphVisualizer.WalkCentroidBone      = _contourAnalysisOpts.DrawCentroidBone;
            debugGlyphVisualizer.WalkGlyphBone         = _contourAnalysisOpts.DrawGlyphBone;

            debugGlyphVisualizer.GlyphEdgeOffset = _contourAnalysisOpts.EdgeOffset;

            debugGlyphVisualizer.DrawDynamicOutline    = _contourAnalysisOpts.DynamicOutline;
            debugGlyphVisualizer.DrawRegenerateOutline = _contourAnalysisOpts.DrawRegenerationOutline;
            debugGlyphVisualizer.DrawGlyphPoint        = _contourAnalysisOpts.DrawGlyphPoint;

#if DEBUG
            GlyphDynamicOutline.dbugTestNewGridFitting    = _contourAnalysisOpts.EnableGridFit;
            GlyphDynamicOutline.dbugActualPosToConsole    = _contourAnalysisOpts.WriteFitOutputToConsole;
            GlyphDynamicOutline.dbugUseHorizontalFitValue = _contourAnalysisOpts.UseHorizontalFitAlignment;
#endif


            //------------------------------------------------------

            debugGlyphVisualizer.RenderChar(testChar, _glyphRenderOptions.HintTechnique);
            //----------------------------------------------------

            //--------------------------
            if (_contourAnalysisOpts.ShowGrid)
            {
                //render grid
                RenderGrids(800, 600, _gridSize, painter);
            }
            painter.SetOrigin(0, 0);
            //6. use this util to copy image from Agg actual image to System.Drawing.Bitmap
            PixelFarm.Agg.Imaging.BitmapHelper.CopyToGdiPlusBitmapSameSize(destImg, winBmp);
            //---------------
            //7. just render our bitmap
            g.Clear(Color.White);
            g.DrawImage(winBmp, new Point(30, 100));
            //g.DrawRectangle(Pens.White, new System.Drawing.Rectangle(30, 20, winBmp.Width, winBmp.Height));
        }
Beispiel #2
0
        void RenderSingleCharWithMiniAgg(Typeface typeface, char testChar, float sizeInPoint)
        {
            //---------------
            //set up vinfo
            UI.DebugGlyphVisualizerInfoView vinfo = debugGlyphVisualizer.VisualizeInfoView;

            if (vinfo == null)
            {
                vinfo = new UI.DebugGlyphVisualizerInfoView();
                vinfo.SetTreeView(this.treeView1);
                vinfo.SetFlushOutputHander(() =>
                {
                    painter.SetOrigin(0, 0);
                    //6. use this util to copy image from Agg actual image to System.Drawing.Bitmap
                    PixelFarm.Agg.Imaging.BitmapHelper.CopyToGdiPlusBitmapSameSize(destImg, winBmp);
                    //---------------
                    //7. just render our bitmap
                    g.Clear(Color.White);
                    g.DrawImage(winBmp, new Point(30, 100));
                });
                debugGlyphVisualizer.VisualizeInfoView = vinfo;
            }

            //---------------
            //we use the debugGlyphVisualize the render it
            this.debugGlyphVisualizer.SetFont(typeface, sizeInPoint);

            debugGlyphVisualizer.UseLcdTechnique = this.chkLcdTechnique.Checked;
            debugGlyphVisualizer.CanvasPainter   = painter;
            debugGlyphVisualizer.FillBackGround  = chkFillBackground.Checked;
            debugGlyphVisualizer.DrawBorder      = chkBorder.Checked;

            debugGlyphVisualizer.ShowTess = chkShowTess.Checked;
            debugGlyphVisualizer.WalkTrianglesAndEdges = this.chkDrawTriangles.Checked;
            debugGlyphVisualizer.DrawEndLineHub        = this.chkDrawLineHubConn.Checked;
            debugGlyphVisualizer.DrawPerpendicularLine = this.chkDrawPerpendicularLine.Checked;
            debugGlyphVisualizer.WalkCentroidBone      = this.chkDrawCentroidBone.Checked;
            debugGlyphVisualizer.WalkGlyphBone         = this.chkDrawGlyphBone.Checked;
            debugGlyphVisualizer.GlyphEdgeOffset       = (float)this.lstEdgeOffset.SelectedItem;
            debugGlyphVisualizer.DrawDynamicOutline    = chkDynamicOutline.Checked;
            debugGlyphVisualizer.DrawRegenerateOutline = chkDrawRegenerateOutline.Checked;
            debugGlyphVisualizer.DrawGlyphPoint        = chkDrawGlyphPoint.Checked;

#if DEBUG
            GlyphDynamicOutline.dbugTestNewGridFitting    = chkTestGridFit.Checked;
            GlyphDynamicOutline.dbugActualPosToConsole    = chkWriteFitOutputToConsole.Checked;
            GlyphDynamicOutline.dbugUseHorizontalFitValue = chkUseHorizontalFitAlign.Checked;
#endif


            //------------------------------------------------------

            debugGlyphVisualizer.RenderChar(testChar, (HintTechnique)lstHintList.SelectedItem);
            //----------------------------------------------------

            //--------------------------
            if (chkShowGrid.Checked)
            {
                //render grid
                RenderGrids(800, 600, _gridSize, painter);
            }
            painter.SetOrigin(0, 0);
            //6. use this util to copy image from Agg actual image to System.Drawing.Bitmap
            PixelFarm.Agg.Imaging.BitmapHelper.CopyToGdiPlusBitmapSameSize(destImg, winBmp);
            //---------------
            //7. just render our bitmap
            g.Clear(Color.White);
            g.DrawImage(winBmp, new Point(30, 100));
            //g.DrawRectangle(Pens.White, new System.Drawing.Rectangle(30, 20, winBmp.Width, winBmp.Height));
        }