Example #1
0
        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);
        }
Example #2
0
 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
 }
        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);
            }
        }
Example #4
0
 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);
 }
Example #5
0
            /// <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;
                }
            }
Example #6
0
		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 );
			}
		}