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


C# Bitmap.StretchImage方法代码示例

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


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

示例1: RenderRectangle

        protected internal override void RenderRectangle(Bitmap bmp, Pen pen, int x, int y, int width, int height, int xCornerRadius, int yCornerRadius)
        {
            if (Stretch == Stretch.None)
                bmp.DrawImage(x, y, BitmapSource, 0, 0, BitmapSource.Width, BitmapSource.Height, Opacity);
            else if (width == BitmapSource.Width && height == BitmapSource.Height)
                bmp.DrawImage(x, y, BitmapSource, 0, 0, width, height, Opacity);
            else
                bmp.StretchImage(x, y, BitmapSource, width, height, Opacity);

            if (pen != null && pen.Thickness > 0)
                bmp.DrawRectangle((MSMedia.Color)pen.Color, pen.Thickness, x, y, width, height, xCornerRadius, yCornerRadius, (MSMedia.Color)0, 0, 0, (MSMedia.Color)0, 0, 0, 0);
        }
开发者ID:KonstantinKolesnik,项目名称:MFE,代码行数:12,代码来源:ImageBrush.cs

示例2: 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

示例3: 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

示例4: StretchImage

 public void StretchImage(int xDst, int yDst, int widthDst, int heightDst, Bitmap bitmap, int xSrc, int ySrc, int widthSrc, int heightSrc, ushort opacity)
 {
     bitmap.StretchImage(translationX + xDst, translationY + yDst, widthDst, heightDst, bitmap, xSrc, ySrc, widthSrc, heightSrc, opacity);
 }
开发者ID:KonstantinKolesnik,项目名称:MFE,代码行数:4,代码来源:DrawingContext.cs

示例5: OnTouchGestureChanged

            /// <summary>
            /// Handles multi-touch gesture events.  Multitouch gestures are performed on the emulator by
            /// holding down CTRL+[Z|P|R] and inking (to change the angle/zoom level).
            /// </summary>
            /// <param name="e">Touch gesture event data</param>
            protected override void OnTouchGestureChanged(TouchGestureEventArgs e)
            {
                base.OnTouchGestureChanged(e);

                Bitmap b;
                switch (e.Gesture)
                {
                    /// 
                    /// Zoom gesture magnifies the original bitmap by the gesture value contained in e.Arguments
                    /// 
                    case TouchGesture.Zoom:
                        if (_bmpGesture != null)
                        {
                            b = new Bitmap(_bitmap.Width, _bitmap.Height);
                            b.DrawRectangle(Color.Black, 1, 0, 0, b.Width - 2, b.Height - 2, 0, 0, Color.White, 0, 0, Color.White, b.Width, b.Height, Bitmap.OpacityOpaque);
                            b.StretchImage(-(e.Arguments), -(e.Arguments), _bmpGesture, _bmpGesture.Width + 2 * (e.Arguments), _bmpGesture.Height + 2 * (e.Arguments), Bitmap.OpacityOpaque);
                            _bitmap = b;
                            Invalidate();
                        }
                        break;
                    /// 
                    /// Pan (zoom out) gesture shrinks the original bitmap by the gesture value contained in e.Arguments
                    /// 
                    case TouchGesture.Pan:
                        if (_bmpGesture != null)
                        {
                            b = new Bitmap(_bitmap.Width, _bitmap.Height);
                            b.DrawRectangle(Color.Black, 1, 0, 0, b.Width - 2, b.Height - 2, 0, 0, Color.White, 0, 0, Color.White, b.Width, b.Height, Bitmap.OpacityOpaque);
                            b.StretchImage((e.Arguments), (e.Arguments), _bmpGesture, _bmpGesture.Width - 2 * (e.Arguments), _bmpGesture.Height - 2 * (e.Arguments), Bitmap.OpacityOpaque);
                            _bitmap = b;
                            Invalidate();
                        }
                        break;
                    /// 
                    /// Rotate gesture spins the original bitmap by the gesture value contained in e.Angle (0-360).
                    /// 
                    case TouchGesture.Rotate:
                        if (_bmpGesture != null)
                        {
                            b = new Bitmap(_bitmap.Width, _bitmap.Height);
                            b.DrawRectangle(Color.Black, 1, 0, 0, b.Width, b.Height, 0, 0, Color.White, 0, 0, Color.White, b.Width, b.Height, Bitmap.OpacityOpaque);
                            b.RotateImage((int)e.Angle, 1, 1, _bmpGesture, 1, 1, _bmpGesture.Width - 2, _bmpGesture.Height - 2, Bitmap.OpacityOpaque);
                            _bitmap = b;
                            Invalidate();
                        }
                        break;
                }
            }
开发者ID:awakegod,项目名称:NETMF-LPC,代码行数:53,代码来源:Program.cs

示例6: Run

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

				Resources.BitmapResources[] bitmaps = new Resources.BitmapResources[]
				{
					Resources.BitmapResources.Outlook0,
					Resources.BitmapResources.Outlook1,
					Resources.BitmapResources.Outlook2,
				};

				for(int i = 0; i < bitmaps.Length; i++ )
				{
					Bitmap src = Resources.GetBitmap( bitmaps[i] );

					for(int s = 0; s <= 800; s++)
					{
						int w = s * Dimensions.Width / 200;
						int h = s * Dimensions.Height / 200;
						int x = (Dimensions.Width - w) / 2;
						int y = (Dimensions.Height - h) / 2;

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

					Thread.Sleep( 3000 );
				}
				Pass = true;
			}
			catch (Exception e)
			{
				UnexpectedException( e );
			}
		}
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:37,代码来源:Main.cs


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