当前位置: 首页>>代码示例>>C#>>正文


C# Bitmap.Flush方法代码示例

本文整理汇总了C#中Microsoft.SPOT.Bitmap.Flush方法的典型用法代码示例。如果您正苦于以下问题:C# Bitmap.Flush方法的具体用法?C# Bitmap.Flush怎么用?C# Bitmap.Flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.SPOT.Bitmap的用法示例。


在下文中一共展示了Bitmap.Flush方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run

        public override void Run()
        {
            try
            {
                using (var bmp = new Bitmap(Dimensions.Width, Dimensions.Height))
                {
                    const string text = "Hello World";
                    int textWidth, textHeight;

                    Font font = Resources.GetFont(Resources.FontResources.ninabd18ppem);
                    font.ComputeExtent(text, out textWidth, out textHeight);
                    int textX = (Dimensions.Width - textWidth)/2;

                    var rand = new Random();

                    for (int x = 0; x < 3; x++)
                    {
                        int baseColor = rand.Next(0xffff);
                        for (int i = 0; i < Dimensions.Height; i++)
                        {
                            bmp.Clear();
                            bmp.DrawText(text, font, (Color) (((255 - i) << 16) | baseColor), textX, i);
                            bmp.Flush();
                        }
                    }
                }
                Pass = true;
            }
            catch (Exception e)
            {
                UnexpectedException(e);
            }
        }
开发者ID:dario-l,项目名称:kodfilemon.blogspot.com,代码行数:33,代码来源:DrawTextTest.cs

示例2: Run

        public override void Run()
        {
            try
            {
                using (var bmp = new Bitmap(Dimensions.Width, Dimensions.Height))
                {
                    bmp.DrawLine(Colors.Red, 1,
                                 Dimensions.Width/2, Dimensions.Height/2,
                                 Dimensions.Width, Dimensions.Height/2);

                    bmp.DrawLine(Colors.Green, 1,
                                 Dimensions.Width/2, Dimensions.Height/2,
                                 Dimensions.Width/2, 0);

                    bmp.Flush();
                }

                Thread.Sleep(3000);
                Pass = true;
            }
            catch (Exception e)
            {
                UnexpectedException(e);
            }
        }
开发者ID:dario-l,项目名称:kodfilemon.blogspot.com,代码行数:25,代码来源:Orientation.cs

示例3: DisplayFile

 public void DisplayFile(string fileName)
 {
     var bitmap = new Bitmap(320, 240);
     var image = _sdCardDevice.LoadBitmap(fileName, Bitmap.BitmapImageType.Jpeg);
     bitmap.DrawImage((320 - image.Width) / 2, (240 - image.Height) / 2, image, 0, 0, image.Width, image.Height);
     bitmap.Flush();
 }
开发者ID:GadgeteerSouthCoast,项目名称:ImageViewer,代码行数:7,代码来源:Program.cs

示例4: Run

        public override void Run()
        {
            try
            {
                using (var bmp = new Bitmap(Dimensions.Width, Dimensions.Height))
                {
                    var rand = new Random();

                    for (int i = 0; i < 100; i++)
                    {
                        var fillColor = (Color)rand.Next(0xFFFFFF);
                        bmp.DrawRectangle((Color) rand.Next(0xFFFFFF), rand.Next(1),
                                          rand.Next(Dimensions.Width), rand.Next(Dimensions.Height),
                                          rand.Next(Dimensions.Width), rand.Next(Dimensions.Height),
                                          0, 0, fillColor, 0, 0, fillColor, 0, 0, (ushort) rand.Next(256));
                        bmp.Flush();
                    }
                }
                Pass = true;
            }
            catch (Exception e)
            {
                UnexpectedException(e);
            }
        }
开发者ID:dario-l,项目名称:kodfilemon.blogspot.com,代码行数:25,代码来源:RandomDrawRectangle.cs

示例5: Run

        public override void Run()
        {
            using (var bitmap = new Bitmap(Dimensions.Width, Dimensions.Height))
            {
                using (var img = Resources.GetBitmap(Resources.BitmapResources.compass2))
                {
                    int da = 3;
                    for (int angle = 0; angle <= 360 && angle >= 0; angle += da)
                    {
                        bitmap.DrawRectangle(Colors.White, 0, 0, 0,
                                             Dimensions.Width, Dimensions.Height,
                                             0, 0, Colors.White, 0, 0, Colors.White, 0, 0,
                                             Bitmap.OpacityOpaque);

                        int xdst = (Dimensions.Width - img.Width)/2,
                            ydst = (Dimensions.Height - img.Height)/2;
                        bitmap.RotateImage(angle, xdst, ydst, img, 0, 0, img.Width, img.Height, 0x00);
                        
                        bitmap.Flush();

                        if (angle > 180)
                            da = -da;
                    }
                }
            }
        }
开发者ID:dario-l,项目名称:kodfilemon.blogspot.com,代码行数:26,代码来源:Rotate.cs

示例6: Run

        public override void Run()
        {
            try
            {
                using (var bmp = new Bitmap(Dimensions.Width, Dimensions.Height))
                {
                    int size = System.Math.Min(Dimensions.Width, Dimensions.Height);

                    for (int i = 0; i < size; ++i)
                        bmp.SetPixel(i, i, (Color)((255 - i) << 16));

                    for (int i = 0; i < size; i += 2)
                        bmp.SetPixel(size - i, i, (Color)(i << 8));

                    bmp.Flush();
                }

                Thread.Sleep(3000);
                Pass = true;
            }
            catch (Exception e)
            {
                UnexpectedException(e);
            }
        }
开发者ID:dario-l,项目名称:kodfilemon.blogspot.com,代码行数:25,代码来源:GreenBlueX.cs

示例7: Run

        public override void Run()
        {
            try
            {
                using (var bmp = new Bitmap(Dimensions.Width, Dimensions.Height))
                {
                    var bitmaps = new[]
                                      {
                                          Resources.BitmapResources.cat2,
                                          Resources.BitmapResources.cat1,
                                          Resources.BitmapResources.cat3
                                      };

                    for (int i = 0; i < bitmaps.Length; i++)
                    {
                        using (Bitmap src = Resources.GetBitmap(bitmaps[i]))
                            bmp.DrawImage(0, 0, src, 0, 0, src.Width, src.Height);

                        bmp.Flush();

                        Thread.Sleep(2000);
                    }
                }
                Pass = true;
            }
            catch (Exception e)
            {
                UnexpectedException(e);
            }
        }
开发者ID:dario-l,项目名称:kodfilemon.blogspot.com,代码行数:30,代码来源:SlideShow.cs

示例8: Main

        public static void Main()
        {
            LCD myApplication = new LCD();

            Window mainWindow = myApplication.CreateWindow();
            
            // Start the application
            //myApplication.Run(mainWindow);

            Bitmap bitmap1 = new Bitmap(SystemMetrics.ScreenWidth,SystemMetrics.ScreenHeight);
            Bitmap bitmap2 = new Bitmap(SystemMetrics.ScreenWidth, SystemMetrics.ScreenHeight);

            int ox = 0;
            int oy = 0;
            int rx = bitmap1.Width;
            int ry = bitmap1.Height;
            int sd=0;
            if (rx < ry)
                sd = rx;
            else
                sd = ry;


	    //
	    // Draw Diagonals
	    //
            bitmap1.DrawLine(Colors.Blue, 3, 0, 0, rx, ry);
            bitmap1.DrawLine(Colors.Blue, 3, rx, 0, 0, ry);

            bitmap2.DrawLine(Colors.Red, 3, 0, 0, rx, ry);
            bitmap2.DrawLine(Colors.Red, 3, rx, 0, 0, ry);


            for(int ioff=0; ioff < sd; ioff += 10)
	    {
		int oX  = ox+ioff;
		int oY  = oy+ioff;
		int wX  = rx - 2*ioff;
		int wY  = ry - 2*ioff;
                bitmap1.DrawRectangle(Colors.White, 1, oX, oY, wX, wY, 1, 1, 
                    Colors.Green, ox, oy, Colors.Green, rx, ry, 0xFF);
                bitmap2.DrawEllipse(Colors.White, rx/2, ry/2, wX, wY);
	    }

            


            while (true)
            {
                bitmap1.Flush();
                Thread.Sleep(250);
                bitmap2.Flush();
                Thread.Sleep(200);
            }

        }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:56,代码来源:lcd.cs

示例9: Run

        public override void Run()
        {
            Font font = Resources.GetFont(Resources.FontResources.ninabd18ppem);
            using (var bitmap = new Bitmap(Dimensions.Width, Dimensions.Height))
            {
                for (int i = 0; i < 4; i++)
                {
                    bitmap.Clear();
                    bitmap.Flush();
                    Thread.Sleep(1000);

                    bitmap.DrawTextInRect("kodFilemon\n.blogspot\n.com", 0, 10,
                                          Dimensions.Width, Dimensions.Height-10,
                                          Bitmap.DT_AlignmentCenter, Colors.White, font);
                    bitmap.Flush();
                    Thread.Sleep(1000);
                }
            }
        }
开发者ID:dario-l,项目名称:kodfilemon.blogspot.com,代码行数:19,代码来源:KodFilemon.cs

示例10: Main

        public static void Main()
        {
            int screenWidth, screenHeight, bitsPerPixel, orientationDeg;
            HardwareProvider.HwProvider.GetLCDMetrics(out screenWidth, out screenHeight,
                                                      out bitsPerPixel, out orientationDeg);
            //prepare background with a color gradient
            Bitmap backgroundImg = new Bitmap(screenWidth, screenHeight);
            backgroundImg.DrawRectangle(Color.White,           // outline color
                                        0,                     // outline thickness
                                        0, 0,                  // x and y of top left corner
                                        backgroundImg.Width,   // width
                                        backgroundImg.Height,  // height
                                        0, 0,                  // x and y corner radius
                                        Color.White,           // gradient start color
                                        0, 0,                  // gradient start coordinates
                                        Color.Black,           // gradient end color
                                        backgroundImg.Width,   // gradient end x coordinate
                                        backgroundImg.Height,  // gradient end y coordinate
                                        Bitmap.OpacityOpaque); // opacity
            //prepare a working buffer to hold graphics before flushing to display
            Bitmap bufferImg = new Bitmap(screenWidth, screenHeight);
            //our ball
            Bitmap soccerBallImg = Resources.GetBitmap(Resources.BitmapResources.SoccerBall);
            //make background of the ball transparent
            //using the color of top left corner pixel
            soccerBallImg.MakeTransparent(soccerBallImg.GetPixel(0, 0));

            int x = 100;
            int y = 50;
            int xOfs = 1;
            int yOfs = 1;
            while (true)
            {
                //copy background to buffer
                bufferImg.DrawImage(0, 0, backgroundImg, 0, 0,
                                    backgroundImg.Width, backgroundImg.Height);
                //paint moving sprite object
                bufferImg.DrawImage(x, y,     // destination coordinates
                                    soccerBallImg, // source image
                                    0, 0,       // source coordinates
                                    soccerBallImg.Width, soccerBallImg.Height,
                                    Bitmap.OpacityOpaque);
                bufferImg.Flush(); //flush buffer to display
                Thread.Sleep(10);
                //invert direction if ball bounces at a wall
                if (x <= 0 || x >= screenWidth - soccerBallImg.Width)
                    xOfs = -xOfs;
                if (y <= 0 || y >= screenHeight - soccerBallImg.Height)
                    yOfs = -yOfs;
                //calculate new coordinates
                x += xOfs;
                y += yOfs;
            }
        }
开发者ID:meikeric,项目名称:DotCopter,代码行数:54,代码来源:Program.cs

示例11: Run

        public override void Run()
        {
            try
            {
                using (var bmp = new Bitmap(Dimensions.Width, Dimensions.Height))
                {
                    //var resId = Resources.BitmapResources.smile;
                    var resId = Resources.BitmapResources.spotlogo110;
                    using (Bitmap src = Resources.GetBitmap(resId))
                    {
                        if(resId == Resources.BitmapResources.smile)
                            src.MakeTransparent(src.GetPixel(0,0));

                        var rand = new Random();

                        int xPos = rand.Next(Dimensions.Width - src.Width);
                        int yPos = rand.Next(Dimensions.Height - src.Height);

                        int xDir = 3;
                        int yDir = 4;

                        for (int animcount = 0; animcount < 100; animcount++)
                        {
                            bmp.Clear();
                            bmp.DrawImage(xPos, yPos, src, 0, 0, src.Width, src.Height);
                            bmp.Flush();

                            xPos = xPos + xDir;
                            yPos = yPos + yDir;

                            if (xPos + src.Width > bmp.Width || xPos < 0)
                            {
                                xDir = -xDir;
                                xPos += xDir;
                            }
                            if (yPos + src.Height > bmp.Height || yPos < 0)
                            {
                                yDir = -yDir;
                                yPos += yDir;
                            }

                            Thread.Sleep(10);
                        }
                    }
                }
                Pass = true;
            }
            catch (Exception e)
            {
                UnexpectedException(e);
            }
        }
开发者ID:dario-l,项目名称:kodfilemon.blogspot.com,代码行数:52,代码来源:Bouncy.cs

示例12: Main

        public static void Main()
        {
            LCD myApplication = new LCD();

            Window mainWindow = myApplication.CreateWindow();
            
            // Start the application
            //myApplication.Run(mainWindow);

            Bitmap bitmap1 = new Bitmap(SystemMetrics.ScreenWidth,SystemMetrics.ScreenHeight);
            Bitmap bitmap2 = new Bitmap(SystemMetrics.ScreenWidth, SystemMetrics.ScreenHeight);

            int ox = 0;
            int oy = 0;
            int rx = bitmap1.Width;
            int ry = bitmap1.Height;
            int sd=0;
            if (rx < ry)
                sd = rx;
            else
                sd = ry;


            bitmap1.DrawLine(Colors.Blue, 1, 0, 0, rx, ry);
            bitmap1.DrawLine(Colors.Blue, 1, rx, 0, 0, ry);
            bitmap1.DrawRectangle(Color.White, 10, ox, oy, rx, ry, 1, 1, 
                Color.White, ox, oy, Color.White, rx, ry, 0xFF);

            for(int i=0; i < sd; i += 10)
                bitmap1.DrawRectangle(Color.White, 1, ox+i, oy+i, rx-i, ry-i, 1, 1, 
                    Colors.Green, ox, oy, Colors.Green, rx, ry, 0xFF);

            
            bitmap2.DrawLine(Colors.Black, 1, 0, 0, rx, ry);
            bitmap2.DrawLine(Microsoft.SPOT.Presentation.Media.Color.Black, 1, rx, 0, 0, ry);

            for (int i = 0; i < sd; i += 10)
                bitmap1.DrawRectangle(Color.White, 1, ox + i, oy + i, rx - i, ry - i, 1, 1,
                    Colors.Green, ox, oy, Colors.Green, rx, ry, 0xFF);

            while (true)
            {
                bitmap1.Flush();
                Thread.Sleep(50);
                bitmap2.Flush();
                Thread.Sleep(50);
            }

        }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:49,代码来源:lcd.cs

示例13: Main

 public static void Main()
 {
     int screenWidth, screenHeight, bitsPerPixel, orientationDeg;
     HardwareProvider.HwProvider.GetLCDMetrics(out screenWidth, out screenHeight,
                                               out bitsPerPixel, out orientationDeg);
     Bitmap bmp = new Bitmap(screenWidth, screenHeight);
     Bitmap soccerBall = Resources.GetBitmap(Resources.BitmapResources.SoccerBall);
     bmp.StretchImage(100, 50,            // destination coordinates
                   soccerBall,            // source image
                   soccerBall.Width / 2,  // half width
                   soccerBall.Height * 2, // double height
                   Bitmap.OpacityOpaque); // opacity
     bmp.Flush();
     Thread.Sleep(-1); //do not terminate app to see result
 }
开发者ID:meikeric,项目名称:DotCopter,代码行数:15,代码来源:Program.cs

示例14: Main

        public static void Main()
        {
            // initialize display buffer
            _display = new Bitmap(Bitmap.MaxWidth, Bitmap.MaxHeight);

            // sample "hello world" code
            _display.Clear();
            Font fontNinaB = Resources.GetFont(Resources.FontResources.NinaB);
            _display.DrawText("Waiting.", fontNinaB, Color.White, 10, 64);
            _display.Flush();

            var connection = new Connection("COM3", new CSVChannel());
            connection.Open();
            connection.OnReceived+=connection_OnReceived;
            // go to sleep; all further code should be timer-driven or event-driven
            Thread.Sleep(Timeout.Infinite);
        }
开发者ID:nothingmn,项目名称:zVirtualScenes-Client,代码行数:17,代码来源:Program.cs

示例15: Run

        public override void Run()
        {
            try
            {
                using (var bmp = new Bitmap(Dimensions.Width, Dimensions.Height))
                {
                    var bitmaps = new[]
                                      {
                                          Resources.BitmapResources.out0,
                                          Resources.BitmapResources.out1,
                                          Resources.BitmapResources.out2
                                      };

                    for (int i = 0; i < bitmaps.Length; i++)
                    {
                        using (Bitmap src = Resources.GetBitmap(bitmaps[i]))
                        {
                            for (int s = 0; ; s += 3)
                            {
                                int w = s * Dimensions.Width / 200;
                                int h = s * Dimensions.Height / 200;

                                if (w > (Dimensions.Width) && h > (Dimensions.Height))
                                    break;

                                int x = (Dimensions.Width - w) / 2;
                                int y = (Dimensions.Height - h) / 2;

                                bmp.StretchImage(x, y, src, w, h, 256);
                                bmp.Flush();

                                
                            }
                        }

                        Thread.Sleep(1000);
                    }
                }
                Pass = true;
            }
            catch (Exception e)
            {
                UnexpectedException(e);
            }
        }
开发者ID:dario-l,项目名称:kodfilemon.blogspot.com,代码行数:45,代码来源:StretchImage.cs


注:本文中的Microsoft.SPOT.Bitmap.Flush方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。