Пример #1
0
        public void BitBlt(Resources.BalloonItemPic_Base pic, RectangleF pos, RectangleF tex, float alpha = 1.0f)
        {
            if (pic == null)
            {
                return;
            }
            if (pic.bitmap == null)
            {
                return;
            }
            const int fix = 1;
            float     w   = (int)pic.bitmap.GetWidth() + fix;
            float     h   = (int)pic.bitmap.GetHeight() + fix;

            _Sprite.Texture = pic.bitmap;
            _Sprite.Left    = (int)(pos.X);
            _Sprite.Top     = (int)(pos.Y);
            _Sprite.Alpha   = alpha;
            //_Sprite.SizeY = pos.Width;
            //_Sprite.SizeX = pos.Height;
            //_Sprite.Rotation = 0;
            _Sprite.TextureLeft   = (tex.Left + fix) / w;
            _Sprite.TextureTop    = (tex.Top + fix) / h;
            _Sprite.TextureRight  = (tex.Right + fix) / w;
            _Sprite.TextureBottom = (tex.Bottom + fix) / h;

            //_Sprite.ScaleX = pos.Width / (pic.GetWidth() * 1);
            //_Sprite.ScaleY = pos.Height / (pic.GetHeight() * 1);

            _Sprite.ScaleX = pos.Width / (w - fix);
            _Sprite.ScaleY = pos.Height / (h - fix);

            _Sprite.Render();
        }
Пример #2
0
        public void BitBlt(Resources.BalloonItemPic_Base pic, float x, float y, RectangleF tex, float alpha = 1.0f)
        {
            /*
             * float w = pic.bitmap.GetWidth()+1;
             * float h = pic.bitmap.GetHeight()+1;
             *
             * BitBlt( pic.bitmap,
             *      new RectangleF((int)x,(int)y, (int)(tex.Width), (int)(tex.Height)),
             *      new RectangleF((int)(tex.X+1) / w, (int)(tex.Y+1) / h, (int)(tex.Width) / w, (int)(tex.Height) / h),
             *      alpha);
             */
            if (pic == null)
            {
                return;
            }
            if (pic.bitmap == null)
            {
                return;
            }
            const int fix = 1;
            float     w   = (int)pic.bitmap.GetWidth() + fix;
            float     h   = (int)pic.bitmap.GetHeight() + fix;

            _Sprite.Texture = pic.bitmap;
            _Sprite.Left    = (x);
            _Sprite.Top     = (y);
            _Sprite.Alpha   = alpha;
            //_Sprite.SizeY = pos.Width;
            //_Sprite.SizeX = pos.Height;
            //_Sprite.Rotation = 0;
            _Sprite.TextureLeft   = (tex.Left + fix) / w;
            _Sprite.TextureTop    = (tex.Top + fix) / h;
            _Sprite.TextureRight  = (tex.Right + fix) / w;
            _Sprite.TextureBottom = (tex.Bottom + fix) / h;

            //_Sprite.ScaleX = pos.Width / (pic.GetWidth() * 1);
            //_Sprite.ScaleY = pos.Height / (pic.GetHeight() * 1);

            _Sprite.ScaleX = tex.Width / (w - fix);
            _Sprite.ScaleY = tex.Height / (h - fix);

            _Sprite.Render();
        }