コード例 #1
0
ファイル: DesktopBitmap.cs プロジェクト: tzachshabtay/MonoAGS
        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));
        }
コード例 #2
0
ファイル: AndroidBitmap.cs プロジェクト: tzachshabtay/MonoAGS
        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));
        }
コード例 #3
0
 public override void Init()
 {
     base.Init();
     Entity.Bind <IAreaComponent>(c => _area = c, _ => _area = null);
     refreshRoom();
     _state.Rooms?.OnListChanged?.Subscribe(onRoomsChanged);
 }
コード例 #4
0
        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));
        }
コード例 #5
0
        public AGSArea(string id, Resolver resolver) : base(id, resolver)
        {
            _areaComponent = AddComponent <IAreaComponent>();

            beforeInitComponents(resolver);
            InitComponents();
            afterInitComponents(resolver);
        }
コード例 #6
0
ファイル: AGSArea.cs プロジェクト: tzachshabtay/MonoAGS
        public AGSArea(string id, Resolver resolver) : base(id, resolver)
        {
            _areaComponent = AddComponent<IAreaComponent>();

            beforeInitComponents(resolver);
            InitComponents();
            afterInitComponents(resolver);
        }
コード例 #7
0
		public override void Init(IEntity entity)
        {
            base.Init(entity);
            _area = entity.GetComponent<IAreaComponent>();
        }
コード例 #8
0
 public override void Init(IEntity entity)
 {
     base.Init(entity);
     _area = entity.GetComponent <IAreaComponent>();
 }
コード例 #9
0
 public override void Init()
 {
     base.Init();
     _area = Entity.GetComponent <IAreaComponent>();
 }
コード例 #10
0
ファイル: AGSZoomArea.cs プロジェクト: tzachshabtay/MonoAGS
 public override void Init()
 {
     base.Init();
     Entity.Bind <IAreaComponent>(c => _area = c, _ => _area = null);
 }