本文整理汇总了C#中System.Drawing.Bitmap.Select方法的典型用法代码示例。如果您正苦于以下问题:C# Bitmap.Select方法的具体用法?C# Bitmap.Select怎么用?C# Bitmap.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Bitmap
的用法示例。
在下文中一共展示了Bitmap.Select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: button1_Click
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
SaveFileDialog sfd = new SaveFileDialog();
ofd.Multiselect = true;
var oResult= ofd.ShowDialog();
if (oResult==DialogResult.OK)
{
var files = ofd.FileNames;
var temp1 = files.ToList();
temp1.Sort();
files = temp1.ToArray();
Bitmap[] bitmaps = new Bitmap[files.Length];
for (int i = 0; i < files.Length; i++)
{
bitmaps[i] = new Bitmap(files[i]);
}
Bitmap output = new Bitmap(bitmaps[0].Width, bitmaps.Select(temp=>temp.Height).Sum());
int yy = 0;
for (int i = 0; i < bitmaps.Length; i++)
{
for (int y = 0; y < bitmaps[i].Height; y++)
{
for (int x = 0; x < bitmaps[i].Width; x++)
{
var c = bitmaps[i].GetPixel(x, y);
output.SetPixel(x,yy, c);
}
yy++;
}
}
if (sfd.ShowDialog() == DialogResult.OK)
{
output.Save(sfd.FileName, ImageFormat.Jpeg);
}
}
sfd.Dispose();
ofd.Dispose();
}
示例2: Render
public void Render(Bitmap[] images, float left, float top, float right, float bottom)
{
images = (images ?? new Bitmap[0]).Select(i => ((Bitmap)i.Clone()).ScaleTo(PrintBounds.Size)).ToArray();
if (!images.Any()) return;
var scanStart = Horizontal ? top : left;
var scanEnd = Horizontal ? bottom : right;
var lineStart = Horizontal ? left : top;
var lineEnd = Horizontal ? right : bottom;
var scanSize = Dpi/Lpi;
var scanStep = scanSize/images.Length;
var pens = images.Select(i => new Pen(new TextureBrush(i), scanStep)).ToArray();
for (var position = scanStart; position < scanEnd; position += scanStep * pens.Length)
for (var index = 0; index < pens.Length; index++) {
var pen = pens[index];
var offset = scanStep*index;
RenderLine(_context.Graphics, pen, position + offset, lineStart, lineEnd);
}
pens.ToList().ForEach(p => p.Dispose());
images.ToList().ForEach(i => i.Dispose());
}
示例3: Load
public void Load(Bitmap[] maps)
{
transform = BuildTransform(maps.Select(m => m.Size).ToArray());
var bitmap = Merge(maps);
this.parent.Resize(bitmap.Size);
this.parent.LoadBitmap(bitmap);
}