本文整理汇总了C#中IArea.IsInArea方法的典型用法代码示例。如果您正苦于以下问题:C# IArea.IsInArea方法的具体用法?C# IArea.IsInArea怎么用?C# IArea.IsInArea使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IArea
的用法示例。
在下文中一共展示了IArea.IsInArea方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyArea
public IBitmap ApplyArea(IArea area)
{
//todo: performance can be improved by only creating a bitmap the size of the area, and not the entire background.
//This will require to change the rendering as well to offset the location
byte zero = (byte)0;
Bitmap output = Bitmap.CreateBitmap(Width, Height, Bitmap.Config.Argb8888);
using (FastBitmap inBmp = new FastBitmap (_bitmap))
{
using (FastBitmap outBmp = new FastBitmap (output, true))
{
for (int y = 0; y < Height; y++)
{
int bitmapY = Height - y - 1;
for (int x = 0; x < Width; x++)
{
global::Android.Graphics.Color color = inBmp.GetPixel(x, bitmapY);
byte alpha = area.IsInArea(new AGS.API.PointF(x, y)) ? color.A : zero;
outBmp.SetPixel(x, bitmapY, new global::Android.Graphics.Color(color.R, color.G, color.B, alpha));
}
}
}
}
return new AndroidBitmap(output, _graphics);
}
示例2: ApplyArea
public IBitmap ApplyArea(IArea area)
{
//todo: performance can be improved by only creating a bitmap the size of the area, and not the entire background.
//This will require to change the rendering as well to offset the location
byte zero = (byte)0;
Bitmap output = new Bitmap(Width, Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
using (FastBitmap inBmp = new FastBitmap (_bitmap, ImageLockMode.ReadOnly))
{
using (FastBitmap outBmp = new FastBitmap (output, ImageLockMode.WriteOnly, true))
{
for (int y = 0; y < Height; y++)
{
int bitmapY = Height - y - 1;
for (int x = 0; x < Width; x++)
{
System.Drawing.Color color = inBmp.GetPixel(x, bitmapY);
byte alpha = area.IsInArea(new AGS.API.PointF(x, y)) ? color.A : zero;
outBmp.SetPixel(x, bitmapY, System.Drawing.Color.FromArgb(alpha, color));
}
}
}
}
return new DesktopBitmap(output, _graphics);
}