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


C# Bitmap.Flush方法代碼示例

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


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

示例1: BitmapStressTest_RotateImage

        public MFTestResults BitmapStressTest_RotateImage()
        {
            MFTestResults result = MFTestResults.Fail;
            
            Log.Comment("Rotate bitmaps");
            
            Bitmap bmpSrc = null;
            Bitmap bmpDst = null;
            
            try
            {
                bmpDst = new Bitmap(width, height);

                bmpSrc = new Bitmap(WaterFallJpg.WaterFall, Bitmap.BitmapImageType.Jpeg);
                bmpDst.StretchImage(0, 0, bmpSrc, bmpSrc.Width, bmpSrc.Height, 0x0100);
                bmpDst.Flush();

                System.Threading.Thread.Sleep(200);

                
                for (int i = 1; i < 4; ++i )
                {
                    bmpDst.RotateImage(90 * i , 0, 0, bmpSrc, 0, 0, bmpSrc.Width, bmpSrc.Height, 0xFFFF);
                    bmpDst.Flush();

                    System.Threading.Thread.Sleep(200);
                }

                result = MFTestResults.Pass;
            }
            catch (Exception e)
            {
                Log.Exception( "Caught exception: " + e.Message);
            }
            finally
            {
                if(bmpSrc != null)
                {
                    bmpSrc.Dispose();
                }
                if(bmpDst != null)
                {
                    bmpDst.Dispose();
                }
                Debug.GC(true);
                System.Threading.Thread.Sleep(500);
            }

            return result;
        }
開發者ID:aura1213,項目名稱:netmf-interpreter,代碼行數:50,代碼來源:BitmapTest.cs

示例2: StretchImage

        public MFTestResults StretchImage()
        {
            Bitmap screen = new Bitmap(width, height);

            Bitmap btn = new Bitmap(WaterFallJpg.WaterFall, Bitmap.BitmapImageType.Jpeg);
            
            screen.StretchImage(10, 10, 15, 75,
                                    btn,
                                    btn.Width / 2, 0, btn.Width / 2, btn.Height / 2,
                                    256);

            screen.Flush();

            screen.StretchImage(20, 20, 30, 150,
                                    btn,
                                    btn.Width / 2, 0, btn.Width / 2, btn.Height / 2,
                                    256);
            screen.Flush();

            screen.StretchImage(40, 40, 60, 250,
                                    btn,
                                    btn.Width / 2, 0, btn.Width / 2, btn.Height / 2,
                                    256);
            screen.Flush();

            System.Threading.Thread.Sleep(500);

            screen.Dispose();
            btn.Dispose();

            return MFTestResults.Pass;
        }
開發者ID:aura1213,項目名稱:netmf-interpreter,代碼行數:32,代碼來源:BitmapTest.cs

示例3: TileImage

        public MFTestResults TileImage()
        {
            Bitmap screen = new Bitmap(width, height);

            Bitmap btn = new Bitmap(WaterFallJpg.WaterFall, Bitmap.BitmapImageType.Jpeg);
            
            screen.DrawRectangle(Color.White, 0, 0, 0, width, height, 0, 0, Color.White, 0, 0, 0, 0, 0, 256);

            screen.TileImage( 5, 10, btn, width - 50, height / 2, 256);

            screen.Flush();

            System.Threading.Thread.Sleep(500);

            screen.Dispose();
            btn.Dispose();

            return MFTestResults.Pass;
        }
開發者ID:aura1213,項目名稱:netmf-interpreter,代碼行數:19,代碼來源:BitmapTest.cs

示例4: Scale9ImageTest

        public MFTestResults Scale9ImageTest()
        {
            Bitmap screen = new Bitmap(width, height);

            Bitmap btn = new Bitmap(WaterFallJpg.WaterFall, Bitmap.BitmapImageType.Jpeg);

            btn.MakeTransparent(ColorUtility.ColorFromRGB(255, 0, 255));

            screen.DrawRectangle(Color.White, 0, 0, 0, width, height, 0, 0, Color.White, 0, 0, 0, 0, 0, 256);

            screen.Scale9Image(30, 30, width / 3, height / 3, btn, 6, 6, 6, 6, 256);
            screen.Scale9Image(width / 2, height / 2, width / 3, 30, btn, 6, 6, 6, 6, 256);
            screen.Scale9Image(30, height / 2, 30, height / 3, btn, 6, 6, 6, 6, 256);
            screen.Scale9Image(width / 2, 30, 30, 30, btn, 6, 6, 6, 6, 256);

            screen.Flush();

            System.Threading.Thread.Sleep(500);

            screen.Dispose();
            btn.Dispose();

            return MFTestResults.Pass;
        }
開發者ID:aura1213,項目名稱:netmf-interpreter,代碼行數:24,代碼來源:BitmapTest.cs


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