• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            道。道。道

            安全特性不等于安全的特性

               :: 首頁 :: 聯系 :: 聚合  :: 管理

            常用鏈接

            搜索

            •  

            最新評論

            Introduction

            This is a simple example about GDI+ which I used in my first GDI+ project.This article is focused on Double Buffering. First if you want to add GDI+ supports to your project,you can refer to Starting with GDI+ By Christian Graus.
            The main part of my example is in OnPaint function that you can see everything there,Image,Font,Brush and etc.They are very clear so I don't discuss about them.I only explain "Double Buffering" here.


            As you know you can draw images into your windows and create a brush or pen from TextureBrush and draw shapes or line, using the image.Even you can draw a text using the images by supplying TextureBrush.(you can see the examples in this article or Christian Grause articles)

            I think one of the most important use of images is Double Buffernig technique.This technique is used when the drawing we wish to create has many details,and it is time consuming to draw even with a fast computer.In this situation it seems the image creeps on to the screen while being drawn.For example in mapping applications or CAD/CAM applications we would encounter this problem. In this technique instead of drawing in the screen,first we draw into an image and then we draw the iamge into the window. Here is my example in double buffering:

            				   srand( (unsigned)time( NULL ) );
               int number = rand();
               number /= RAND_MAX + 1; 
               number *= 254;
            
               Rect rc(rect.left,rect.top,rect.right,rect.bottom);
                  Bitmap bmp(rect.right,rect.bottom);
            
               // Create a Graphics object that is associated with the image.
               Graphics* graph = Graphics::FromImage(&bmp);
             
               for(int x=0;x<rect.right;x++)
               {
               	for(int y=0; y<rect.bottom; y++)
               	{
               		double number = rand();
              		number /= RAND_MAX + 1; 
            		number *= 254;
            		Pen pen(Color(number,number,number,number));
            		graph->DrawLine(&pen,0,0,x,y);
                    	}
            	}
               // Draw the altered image.
               graphics.DrawImage(&bmp,rect.left,rect.top,rect.right,rect.bottom);
            
            		

            It takes 36 seconds to paint the screen on my computer(AMD 1.33GHtz and 256Mb RAM) without double buffering but only 5 seconds with this technique.You know,it is not interesting to wait 36 seconds each time that your window need to repaint!

            Finally I want to thank Christian Graus for his supports and good articles about GDI+ which I used some of his codes and ideas.

            posted on 2006-11-18 16:43 獨孤九劍 閱讀(350) 評論(0)  編輯 收藏 引用 所屬分類: Visual C++ 8.0
            91精品国产91久久综合| 大伊人青草狠狠久久| 麻豆av久久av盛宴av| 久久人爽人人爽人人片AV| 亚洲熟妇无码另类久久久| 日韩人妻无码精品久久久不卡 | 久久久久18| 久久青青草原亚洲av无码| 久久免费香蕉视频| 久久影视综合亚洲| 久久精品99久久香蕉国产色戒 | 久久久久波多野结衣高潮| 国产情侣久久久久aⅴ免费| 久久人人爽人爽人人爽av| 无码人妻精品一区二区三区久久| 久久99亚洲综合精品首页| 国产成年无码久久久免费| 久久国产精品一区| 久久福利青草精品资源站免费| 久久精品国产乱子伦| 久久性精品| 久久久精品人妻无码专区不卡| 国内精品久久久久久99蜜桃| 久久成人国产精品免费软件| 青青草国产97免久久费观看| 国产成人久久久精品二区三区| 国内精品久久人妻互换| 亚洲va中文字幕无码久久| 噜噜噜色噜噜噜久久| 日日狠狠久久偷偷色综合免费| 久久精品成人影院| 国产精品伦理久久久久久| 99久久精品国产一区二区三区| 青青热久久综合网伊人| 日本免费久久久久久久网站| 色综合久久天天综合| 亚洲精品高清国产一久久| 国产成人精品综合久久久| 国产精品免费久久久久电影网| 久久久精品国产Sm最大网站| 亚洲国产精品综合久久一线|