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


C# Bitmap.Rotate方法代码示例

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


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

示例1: RotateTest

 public void RotateTest()
 {
     Bitmap bitmap1 = new Bitmap(100, 200);
     Bitmap bitmap2 = bitmap1.Rotate(90);
     Assert.Equal(bitmap1.Width, bitmap2.Height);
     Assert.Equal(bitmap1.Height, bitmap2.Width);
 }
开发者ID:donnieyoung,项目名称:osharp,代码行数:7,代码来源:BitmapExtensionsTests.cs

示例2: BaseCreateThumbnail

        public void BaseCreateThumbnail(ImageCreateThumbnail method)
        {
            var mediaType = new MediaTypes(this.Strategy.Session).Png;

            byte[] content;

            // Stream should be left open for Save to work
            using (Stream stream = new MemoryStream(this.Original.Content))
            {
                var thumbnail = new Bitmap(stream);

                thumbnail = thumbnail.Rotate();
                thumbnail = thumbnail.MaxHeight(method.MaxHeight ?? 150);

                content = thumbnail.Save(ImageFormat.Png);
            }

            if (!this.ExistThumbnail || !content.SequenceEqual(this.Thumbnail.Content))
            {
                if (this.ExistThumbnail)
                {
                    this.Thumbnail.Delete();
                }

                this.Thumbnail = new MediaBuilder(this.Strategy.Session).WithContent(content).WithMediaType(mediaType).Build();
            }
        }
开发者ID:whesius,项目名称:allors,代码行数:27,代码来源:Image.cs

示例3: BaseCreateResponsive

        public void BaseCreateResponsive(ImageCreateResponsive method)
        {
            var mediaType = new MediaTypes(this.Strategy.Session).Jpeg;

            byte[] content;

            // Stream should be left open for Save to work
            using (Stream stream = new MemoryStream(this.Original.Content))
            {
                var responsive = new Bitmap(stream);

                responsive = responsive.Rotate();
                responsive = responsive.MaxHeight(method.MaxHeight ?? 600);

                var encoder = ImageCodecInfo.GetImageEncoders().FirstOrDefault(e => e.MimeType == mediaType.Name);
                var encoderParams = new EncoderParameters(1);
                var qualityParam = Encoder.Quality;
                encoderParams.Param[0] = new EncoderParameter(qualityParam, 72L);

                content = responsive.Save(encoder, encoderParams);
            }

            if (!this.ExistResponsive || !content.SequenceEqual(this.Responsive.Content))
            {
                if (this.ExistResponsive)
                {
                    this.Responsive.Delete();
                }

                this.Responsive = new MediaBuilder(this.Strategy.Session).WithContent(content).WithMediaType(mediaType).Build();
            }
        }
开发者ID:whesius,项目名称:allors,代码行数:32,代码来源:Image.cs

示例4: Fold

 static Bitmap Fold(Bitmap bmp, double angle)
 {
     int w = Math.Max((bmp.Width * (0.5 * Math.PI - angle) / (0.5 * Math.PI)).Round(), 1);
     int h = ((0.5 * bmp.Height * angle + bmp.Height * (0.5 * Math.PI - angle)) / (0.5 * Math.PI)).Round();
     bmp = bmp.Resize_ReplaceTransparent(new Size(w, h));
     bmp = bmp.Rotate(angle);
     bmp = bmp.RemoveTransparentEdge();
     return bmp;
 }
开发者ID:fsps60312,项目名称:Digging-Game-2,代码行数:9,代码来源:Drill.cs

示例5: Process

 public void Process()
 {
     using (Bitmap TestObject = new Bitmap(@"..\..\Data\Image\Lenna.jpg"))
     {
         using (Bitmap TestObject2 = TestObject.Rotate(10.0f))
         {
             using (Bitmap Value = Assert.Do<Bitmap>(() => Utilities.Media.Image.MotionDetection.Process(TestObject, TestObject2, 25, Color.Red)))
             {
                 Assert.NotNull(Value);
                 Value.Save(@".\Testing\MotionDetection.jpg", ImageFormat.Jpeg);
             }
         }
     }
 }
开发者ID:gwilkinson,项目名称:Craig-s-Utility-Library,代码行数:14,代码来源:MotionDetection.cs

示例6: ProduceGearImage

 void ProduceGearImage(out Bitmap bac)
 {
     bac = new Bitmap(IMAGES["GearO"]);
     Bitmap bmp = IMAGES["GearB"];
     int h1=bac.Height;
     bac = bac.Rotate(GEAR_ANGLE);
     bac = bac.TakeCenter(bmp.Size);
     bac.DrawOpaque(bmp);
     int h2=bac.Height;
     int h = (bmp.Height * Health.RATIO - 0.5 * (h1 - h2)).Round();
     if (h > 0)
     {
         BitmapData data_bac = bac.GetBitmapData(new Rectangle(0, Math.Max(0, bac.Height - h), bac.Width, Math.Min(bac.Height, h)));
         data_bac.DrawGray(COLOR.FromRToG(Health.RATIO));
         bac.UnlockBits(data_bac);
     }
 }
开发者ID:fsps60312,项目名称:Digging-Game-2,代码行数:17,代码来源:Maintenance+Plant.cs

示例7: GetImage

 protected override void GetImage(out Bitmap bmp)
 {
     base.GetImage(out bmp);
     bmp= bmp.Rotate(ANGLE);
     bmp.Multiply_A(FLASH_RATIO);
 }
开发者ID:fsps60312,项目名称:Digging-Game-2,代码行数:6,代码来源:Arrow.cs

示例8: Rotate

 public void Rotate()
 {
     using (Bitmap TestObject = new Bitmap(@"..\..\Data\Image\Lenna.jpg"))
     {
         using (Bitmap Image = Assert.Do<Bitmap>(() => TestObject.Rotate(50.0f, @".\Testing\LennaRotate.jpg")))
         {
             Assert.NotNull(Image);
         }
     }
 }
开发者ID:gwilkinson,项目名称:Craig-s-Utility-Library,代码行数:10,代码来源:BitmapExtensions.cs

示例9: GetImage

 protected override void GetImage(out Bitmap bmp)
 {
     if (PARENT.BLOOD <= 0.0 && PARENT.DEAD_TIME > PARENT.DEAD_PERIOD) { bmp = null; return; }
     base.GetImage(out bmp);bmp=bmp.Rotate(ANGLE);
     if (PARENT.BLOOD <= 0.0 && PARENT.DEAD_TIME > 0.0) bmp.Multiply_A(1.0 - PARENT.DEAD_TIME / PARENT.DEAD_PERIOD);
 }
开发者ID:fsps60312,项目名称:Digging-Game-2,代码行数:6,代码来源:Weapon.cs

示例10: MotionDetection

 public void MotionDetection()
 {
     using (Bitmap TestObject = new Bitmap(@"..\..\Data\Image\Lenna.jpg"))
     {
         using (Bitmap TestObject2 = TestObject.Rotate(10.0f))
         {
             using (Bitmap Value = TestObject.MotionDetection(TestObject2, 25, Color.Red))
             {
                 Assert.NotNull(Value);
             }
         }
     }
 }
开发者ID:rgshare,项目名称:Craig-s-Utility-Library,代码行数:13,代码来源:BitmapExtensions.cs


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