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


C# Bitmap.RotateImage方法代码示例

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


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

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

示例2: RotateImage

 public void RotateImage(int angle, int destinationX, int destinationY, Bitmap bitmap, int sourceX, int sourceY, int sourceWidth, int sourceHeight, ushort opacity)
 {
     bitmap.RotateImage(angle, translationX + destinationX, translationY + destinationY, bitmap, sourceX, sourceY, sourceWidth, sourceHeight, opacity);
 }
开发者ID:KonstantinKolesnik,项目名称:MFE,代码行数:4,代码来源:DrawingContext.cs

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


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