public IBitmap ApplyArea(IAreaComponent 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 = 0; Bitmap output = new Bitmap(Width, Height, 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 API.PointF(x, y)) ? color.A : zero; outBmp.SetPixel(x, bitmapY, System.Drawing.Color.FromArgb(alpha, color)); } } } } return(new DesktopBitmap(output, _graphics)); }
public IBitmap ApplyArea(IAreaComponent 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)); }
public override void Init() { base.Init(); Entity.Bind <IAreaComponent>(c => _area = c, _ => _area = null); refreshRoom(); _state.Rooms?.OnListChanged?.Subscribe(onRoomsChanged); }
public IBitmap ApplyArea(IAreaComponent 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; UIImage output; using (FastBitmap inBmp = new FastBitmap(_cgImage)) { using (FastBitmap outBmp = new FastBitmap(Width, Height)) { for (int y = 0; y < Height; y++) { int bitmapY = Height - y - 1; for (int x = 0; x < Width; x++) { var color = inBmp.GetPixel(x, bitmapY); byte alpha = area.IsInArea(new AGS.API.PointF(x, y)) ? color.A : zero; outBmp.SetPixel(x, bitmapY, Color.FromRgba(color.R, color.G, color.B, alpha)); } } output = outBmp.GetImage(); } } return(new IOSBitmap(output, _graphics)); }
public AGSArea(string id, Resolver resolver) : base(id, resolver) { _areaComponent = AddComponent <IAreaComponent>(); beforeInitComponents(resolver); InitComponents(); afterInitComponents(resolver); }
public AGSArea(string id, Resolver resolver) : base(id, resolver) { _areaComponent = AddComponent<IAreaComponent>(); beforeInitComponents(resolver); InitComponents(); afterInitComponents(resolver); }
public override void Init(IEntity entity) { base.Init(entity); _area = entity.GetComponent<IAreaComponent>(); }
public override void Init(IEntity entity) { base.Init(entity); _area = entity.GetComponent <IAreaComponent>(); }
public override void Init() { base.Init(); _area = Entity.GetComponent <IAreaComponent>(); }
public override void Init() { base.Init(); Entity.Bind <IAreaComponent>(c => _area = c, _ => _area = null); }