本文整理汇总了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);
}
示例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();
}
}
示例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();
}
}
示例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;
}
示例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);
}
}
}
}
示例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);
}
}
示例7: GetImage
protected override void GetImage(out Bitmap bmp)
{
base.GetImage(out bmp);
bmp= bmp.Rotate(ANGLE);
bmp.Multiply_A(FLASH_RATIO);
}
示例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);
}
}
}
示例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);
}
示例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);
}
}
}
}