當前位置: 首頁>>代碼示例>>C#>>正文


C# DrawingGroup.ToBitmap方法代碼示例

本文整理匯總了C#中System.Windows.Media.DrawingGroup.ToBitmap方法的典型用法代碼示例。如果您正苦於以下問題:C# DrawingGroup.ToBitmap方法的具體用法?C# DrawingGroup.ToBitmap怎麽用?C# DrawingGroup.ToBitmap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Media.DrawingGroup的用法示例。


在下文中一共展示了DrawingGroup.ToBitmap方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Update

        public void Update()
        {
            var output = new DrawingGroup();
            var format = new BasicTextParagraphProperties("Times New Roman", 34, FlowDirection.LeftToRight);
            var words = BoundedWord.GetWords(Text, Measurer.MeasureLines(Text, 200, format, output)).ToList();
            Image = output.ToBitmap();

            ImageData imageData;
            using (var stream = Image.CreateStream())
                imageData = new ImageData(stream);

            var boards = imageData.DefineIteratedBoards();
            var chars = words.SelectMany(w => w.Characters);
            Segments = chars.Select(boards.GetLetterHeuristics).ToList();
        }
開發者ID:Amichai,項目名稱:Prax,代碼行數:15,代碼來源:TrainingContext.cs

示例2: Main

        static void Main(string[] args)
        {
            string fileName = @"C:\Users\Public\Pictures\temp.png";
            string renderMe = "تلبستبي بيسا سي";
            var output = new DrawingGroup();
            BasicTextParagraphProperties format = new BasicTextParagraphProperties("Tahoma", 13, FlowDirection.LeftToRight);
            var segments = TextSegment.GetWords(renderMe, Measurer.MeasureLines(renderMe, 200, format, output)).ToList();
            output.ToBitmap().CreateStream(fileName).Close();
            Document uploadDocument = new Document(fileName);

            //List<string> wordsRendered = renderMe.Split(' ').ToList();
            //List<CharacterBounds> boundsForeachWord = new List<CharacterBounds>();
            //foreach (var word in wordsRendered) {
            //    boundsForeachWord.Add(new CharacterBounds(segments, word));
            //}
            //IteratedBoards boards = uploadDocument.DefineIteratedBoards();
            ////TrainingData trainingData;
            ////foreach (var word in boundsForeachWord) {
            ////    trainingData = boards.Train(word);
            ////}
            //foreach (var testBoard in boards.Segment()) {}
        }
開發者ID:Amichai,項目名稱:Prax,代碼行數:22,代碼來源:Program.cs

示例3: TrainAlgorithm

        //TODO: Test for white space first
        public void TrainAlgorithm()
        {
            string renderText = "أدخل نص هنا لترجمة";
            //string renderText = "ﻂﺎﺉﻳﺕﺍﻈﺕﻊﺹﻫﻑﻈﻂﻟﺐﺻﺔﺛﺅﺡﺽﻛﻟﺊﺒﻖﺼﻞﺫﻳﺀﺎﻠﻜﻯﺛﺠﻔﺡﺜﺠﻹﺡﺕﺨﺜﻛﻃﺜﺗﺯﺘﺈﻞﺄﺰﺦﻨﺂﺳﺋﺳﺟﻃﻪﻃﻤﻣﻭﻱﺚﺽﻷﻦﺁﻁﺹﻊﻞﻲﻷﻶﻁﺓﻃﻥﺅﺂﻗﺿﻲﺵﻑﻪﺐﻩﻚﻛﺧﻢﺵﻵﻓﺨﻹﻯﺝﺟﻝﺿﻳﻘﺉﺌﺸﺒﻮﺋﻼﺅﺽﻢﺋﺭﻻﻢﻨﺍﻕﺔﻤﻛﺢﻹﺽﺂﺣﺙﺖﻑﻇﻣﺢﺘﻈﺙﺫﻄﺱﻺﻷﻎﻛﺢﺥﻏﻩﺥﺩﺗﺇﺐﻆﻈﻘﺘﺶﺍﻌﺶﻬﻕﻱﺫﺺﻖﻀﻰﻢﻡﺶﺣﻘﻗﺙﺖﻼﻼﻔﻫﺕﻺﻬﻼﻉﺶﺜﻖﺼﺰﻠﺞﻵﻸﺎﺢﻙﺯﻤﻋﺏﻵﺿﻄﻝﻡﺵﻬﺯﻂﺘﺶﺵﻞﺠﻮﻥﻱﻟﺄﺺﻦﺳﺲﺁﺘﺪﻜﻉﻴﺹﻍﺘﺉﻛﺜﺻﺧﺟﻥﺁﺭﺧﻷﺗﺪﻥﺗﻗﺜﺹﻥﻍﻠﺐﺥﻂﺍﻃﻅﺶﻕﺣﺸﺈﻇﺞﺬﺂﺃﺳﺽﻒﻶﺃﺌﺿﺸﺚﻓﺯﺒﺄﺬﺺﻐﺀﺴﻵﺶﻗﺭﻡﻗﺮﺨﺊﻫﻯﻌﺌﺹﺕﻔﻦﻸﺒﻓﻝﺄﻢﺉﻯﻬﺕﺤﻐﻳﻺﺵﻇﻦﺴﻉﺨﺅﻙﻷﻇﻗﺂﻐﻆﻊﻇﻲﻺﺭﻃﺾﺽﺩﻓﻰﻐﻎﺺﻱﻁﺊﻕﺓﻭﺺﺅﺢﺄﻈﺫﻠﺟﺘﺌﺆﺂﺑﺿﺤﺤﺟﺦﺣﺰﺼﻴﺞﺒﻀﻶﻗﻇﻤﺶﺼﺂﻫﻟﺌﻅﺥﻮﺱﺁﻟﺟﺥﺝﻍﻮﺾﺎﺖﻌﺡﻠﺱﻠﺱﻂﻣﺏﻁﻏﻐﺘﺷﻞﻌﺃﺓﺮﺳﻜﻼﺮﻲﺡﻍﺝﻎﺀﻂﻎﺷﻉﺱﺘﺔﻙﻍﺊﺮﻆﻞﺕﺭﻞﺭﻇﻤﻃﻍﻉﻛﺏﻗﺶﻍﻯﻫﺐﺒﺔﻱﻢﻊﻯﺗﺇﻣﺞﻉﻰﺳﺉﺀﻩﻺﻦﺁﺓﻰﺆﺵﺊﺰﻵﻰﺨﻮﻷﻈﺢﻪﺽﻴﺚﻒﻸﻈﺺﻆﺦﻠﻅﻶﻚﺖﻑﺏﻫﺹﻣﻮﻗﺜﺌﻛﻧﺲﻒﻻﻬﺕﻨﻓﺧﺅﻳﺑﻣﺗﺁﺞﻄﻉﻉﺢﻬﺐﻒﻞﺞﺘﺃﺾﻡﺱﺒﺠﻨﺻﻨﻅﻲﺻﻗﺑﻵﻯﻏﻔﺟﻀﺩﻓﺷﻄﺩﺎﻐﻦﻬﻖﻝﻰﻜﻓﺒﺪﻮﻳﻰﻓﺦﺧﺬﺸﺨﺈﻯﺸﺪﻺﺾﻺﺾﻛﻬﺬﺆﺝﺇﺄﻍﺁﻋﺑﻥﺂﻜﺃﻻﻊﺀﻘﻡﻉﺚﺁﺧﻻﺛﺡﺛﺗﺼﻯﺘﻠﺱﺁﻤﻣﺣﻑﻬﻫﺆﺤﻘﺚﻐﺦﺩﻬﺺﻜﻺﻢﺘﻲﻀﻫﺄﺇﺁﻢﻦﺵﻁﻙﻶﺄﻍﻚﺛﺘﺧﺫﻨﻳﻃﻲﺥﺌﺫﻱﻵﺫﻚﻜﻲﺲﻇﺼﺽﻵﻞﺛﻐﺊﺅﻍﻠﻻﺡﻌﻖﻋﻐﺡﺵﻎﻷﺢﺮﻋﻅﻴﻙﺌﻩﺺﻘﻢﻤﻃﺹﺐﺜﺣﺷﺋﻘﻞﻭﻳﺒﺦﻨﻜﺛﺪﻘﺸﺧﺣﺸﺥﺎﻯﺰﻦﺿﻃﺝﻈﻱﻺﺗﻚﺒﻅﺯﺭﻧﺩﻳﺘﺲﺷﺸﺞﺌﻺﻭﺿﻞﺠﺺﻁﺋﺔﺂﺩﻯﻍﻉﺕﻀﺤﺂﺔﺏﺍﻊﻓﻷﺪﻍﻻﺭﺟﻰﻓﺷﺒﻚﻂﻒﻛﻦﻑﻀﻓﻏﻺﻂﺅﺺﺚﻝﻞﻕﺍﺵﺣﺎﻼﺰﺚﻄﺴﻏﺼﺓﻨﺡﺫﻯﻝﻰﺇﺿﻢﺻﺮﻑﺹﺻﻌﺐﻲﻬﺳﺝﻌﻇﻢﺞﺓﺃﻛﺒﺸﺗﺲﺁﺃﺿﻣﻘﺖﺒﻚﺦﻖﺞﻯﻏﺇﻏﻒﻁﻠﺉﻎﻄﺛﺞﻄﺡﺼﺍﻜﻚﺕﻲﺇﻊﺈﺬﻍﻷﻔﻱﻷﻠﺒﺌﻄﺭﻔﺓﺖﻀﺮﺙﺮﺯﻅﻫﻢﻢﻷﻂﺜﺉﺳﺀﺑﻡﺗﺥﻆﻘﺁﻗﻩﻫﺏﻫﺲﺎﻗﺗﻉﺨﻳﺛﺫﻸﻃﻕﺅﺚﻆﻨﻼﺑﻔﻭﺬﺑﻸﻠﺖﺯﻉﺻﺾﻓﺭﻀﺟﻖﺸﻔﺊﻠﻶﻰﺒﺗﻑﺖﺝﺿﺟﺬﺑﺖﻗﻘﺖﺞﺾ";
            var output = new DrawingGroup();
            var format = new BasicTextParagraphProperties("Times New Roman", 14, FlowDirection.LeftToRight);
            var words = BoundedWord.GetWords(renderText, Measurer.MeasureLines(renderText, 200, format, output)).ToList();
            var stream = output.ToBitmap().CreateStream();
            var imageData = new ImageData(stream);
            imageData.SaveFile("RenderedFile1.png");
            stream.Close();

            Directory.CreateDirectory(trainingFolder);

            var boards = imageData.DefineIteratedBoards();
            var trainingData = new MutableReferenceSet();

            //ADD TO EXISTING TRAINING DATA LIBRARY:
            //trainingData.ReadFrom(trainingFolder);

            var characters = words.SelectMany(w => w.Characters).ToList();
            for (int i = 0; i < characters.Count(); i++) {
                var ch1 = characters[i];
                var letterHeuristics = boards.GetLetterHeuristics(ch1);
                if (i < characters.Count() - 1) {
                    var ch2 = characters[i + 1];
                    var whitespaceHeuristics = boards.GetSpaceHeuristics(ch1, ch2);
                    trainingData.AddHeuristics(whitespaceHeuristics);
                }
                if (letterHeuristics != null)
                    trainingData.AddHeuristics(letterHeuristics);
            }
            ImageUtilities.Utilities.TrainingLog.ToString();

            trainingData.WriteTo(trainingFolder);
        }
開發者ID:Amichai,項目名稱:Prax,代碼行數:37,代碼來源:ExposedFunctionality.cs


注:本文中的System.Windows.Media.DrawingGroup.ToBitmap方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。