本文整理汇总了C#中System.Drawing.Point.Max方法的典型用法代码示例。如果您正苦于以下问题:C# Point.Max方法的具体用法?C# Point.Max怎么用?C# Point.Max使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Point
的用法示例。
在下文中一共展示了Point.Max方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClippedBitmap
public static Texture2D ClippedBitmap(Texture2D t2d, Point[] pointsArray, out Point position)
{
MemoryStream mStream = new MemoryStream();
t2d.SaveAsPng(mStream, t2d.Width, t2d.Height);
Bitmap texture = new Bitmap(mStream);
int minX = pointsArray.Min(x => x.X);//margin.X >= 0 ? x.X : x.X + margin.X);
int maxX = pointsArray.Max(x => x.X);//margin.X <= 0 ? x.X : x.X + margin.X);
int minY = pointsArray.Min(x => x.Y);//margin.Y >= 0 ? x.Y : x.Y + margin.Y);
int maxY = pointsArray.Max(x => x.Y);//margin.Y <= 0 ? x.X : x.X + margin.X);
position = new Point(minX, minY);
if (maxX - minX <= 0 || maxY - minY <= 0) return Assets.textureDict[textures.whitepixel];
Bitmap bmp = new Bitmap(maxX - minX, maxY - minY);
Point[] offset = new Point[pointsArray.Length];
pointsArray.CopyTo(offset, 0);
offset = Array.ConvertAll(offset, x => x = new Point(x.X - minX, x.Y - minY));
Graphics g = Graphics.FromImage(bmp);
TextureBrush tb = new TextureBrush(texture);
g.FillPolygon(tb, offset);
Color[] pixels = new Color[bmp.Width * bmp.Height];
for (int y = 0; y < bmp.Height; y++)
{
for (int x = 0; x < bmp.Width; x++)
{
System.Drawing.Color c = bmp.GetPixel(x, y);
pixels[(y * bmp.Width) + x] = new Color(c.R, c.G, c.B, c.A);
}
}
Texture2D myTex = new Texture2D(
OrbIt.game.GraphicsDevice,
bmp.Width,
bmp.Height);
myTex.SetData<Color>(pixels);
return myTex;
}