コード例 #1
0
        protected void InitVals(string name, Bitmap bmp, string bmpFilePath, EngineResourceFileIdentifier resourceId)
        {
            _name = name;

            if (bmp != null)
            {
                _bmp = bmp;
            }
            else
            {
                if (resourceId != null)
                {
                    _bmp = new Bitmap(resourceId.Data);
                }
                else
                {
                    _imgFile = bmpFilePath;
                    Bitmap tempBmp = new Bitmap(bmpFilePath);
                    _bmp = new Bitmap(tempBmp, tempBmp.Width, tempBmp.Height);
                    tempBmp.Dispose();
                }
            }

            CreateGDICompatibleBmp();

            if (Tilesheet._tilesheets.ContainsKey(_name))
            {
                Tilesheet._tilesheets[_name].Dispose();
            }

            Tilesheet._tilesheets.Add(_name, this);
            Tilesheet.RecalcMaxOverlapRatio();
        }
コード例 #2
0
        public void Dispose()
        {
            GC.SuppressFinalize(this);

            Tilesheet._tilesheets.Remove(_name);
            Tilesheet.RecalcMaxOverlapRatio();
            pInvoke.DeleteObject(_hBmp);
            _dc.Dispose();
            _bmp.Dispose();

            if (Disposed != null)
            {
                Disposed(new TilesheetDisposedEventArgs(this));
            }
        }