本文整理汇总了C#中Bitmap.Resize方法的典型用法代码示例。如果您正苦于以下问题:C# Bitmap.Resize方法的具体用法?C# Bitmap.Resize怎么用?C# Bitmap.Resize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitmap
的用法示例。
在下文中一共展示了Bitmap.Resize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetImage
protected override void GetImage(out Bitmap bmp)
{
base.GetImage(out bmp);bmp= new Bitmap(bmp);
if (TIME_PASS < END_EXPAND)
{
bmp.Merge_RGB(Color.FromArgb(255, 255, 255), 1.0);
Bitmap ans= bmp.Resize(MAX_RATIO * TIME_PASS / END_EXPAND);
//bmp.Dispose();
bmp = ans;
}
else if (TIME_PASS < END_SHRINK)
{
double ratio = (TIME_PASS - END_EXPAND) / (END_SHRINK - END_EXPAND);
bmp.Merge_RGB(Color.FromArgb(255, 255, 255), 1.0 - ratio);
Bitmap ans = bmp.Resize(MAX_RATIO.Merge(1.0, ratio));
//bmp.Dispose();
bmp = ans;
}
else if (TIME_PASS < PERIOD - HIDE_PERIOD) return;
else
{
double ratio = (TIME_PASS - (PERIOD - HIDE_PERIOD)) / HIDE_PERIOD;
bmp.Multiply_A(1.0 - ratio);
}
}
示例2: GetImage
protected override void GetImage(out Bitmap bac)
{
bac = IMAGE;
if (bac.Size != GetSize()) bac = bac.Resize(RECT.Size);
BitmapData data_bac = bac.GetBitmapData();
DrawLOCKED(data_bac);
bac.UnlockBits(data_bac);
}
示例3: Resize
public static void Resize(Texture2D texture, int width, int height, InterpolationMode mode)
{
Bitmap image;
using (var stream = new MemoryStream(texture.EncodeToPNG()))
{
using (var bitmap = new Bitmap(stream))
{
image = bitmap.Resize(new Size(width, height), mode);
}
stream.Close();
}
using (var stream = new MemoryStream())
{
image.Save(stream, image.RawFormat);
stream.Seek(0, SeekOrigin.Begin);
texture.LoadImage(stream.ToArray());
stream.Close();
}
image.Dispose();
}
示例4: GetImage
protected override void GetImage(out Bitmap bmp)
{
base.GetImage(out bmp);bmp=bmp.Resize(Math.Sqrt(STATE));
if (STATE > 1.0) bmp = bmp.Add_RGB((-300.0 * (STATE - 1.0)).Round());
if (STATE > 1.0) bmp = bmp.Multiply_A((2.0 - STATE) / 1.0);
}