Esempio n. 1
0
        public bool DrawImage(Graphics g, tagBASE pBase, int nXDest, int nYDest)
        {
            if (_bitmap == null)
            {
                return(false);
            }

            CRect rcImage = new CRect(nXDest, nYDest, nXDest + GetWidth(), nYDest + GetHeight());
            CRect rcBack  = new CRect(pBase.ptBase.x, pBase.ptBase.y, pBase.ptBase.x + pBase.nWidth, pBase.ptBase.y + pBase.nHeight);

            if (GameGraphics.IntersectRect(rcImage, rcBack))
            {
                GameGraphics.DrawImage(g, _bitmap, nXDest - pBase.ptBase.x, nYDest - pBase.ptBase.y, GetWidth(), GetHeight(), 0, 0);
            }

            return(true);
        }
Esempio n. 2
0
        bool BitBlt(Graphics g, tagBASE pBase, int nXPos, int nYPos)
        {
            if (_bitmap == null)
            {
                return(false);
            }

            CRect rcImage = new CRect(nXPos, nYPos, nXPos + GetWidth(), nYPos + GetHeight());
            CRect rcBack  = new CRect(pBase.ptBase.x, pBase.ptBase.y, pBase.ptBase.x + pBase.nWidth, pBase.ptBase.y + pBase.nHeight);

            if (GameGraphics.IntersectRect(rcImage, rcBack))
            {
                GameGraphics.BitBlt(g, _bitmap, nXPos - pBase.ptBase.x, nYPos - pBase.ptBase.y, GetWidth(), GetHeight());
            }

            return(true);
        }
Esempio n. 3
0
        bool AlphaDrawImage(Graphics g, tagBASE pBase, int nXPos, int nYPos, int nDestWidth, int nDestHeight, int nXSource, int nYSource, Color tranColor)
        {
            if (_bitmap == null)
            {
                return(false);
            }

            CRect rcImage = new CRect(nXPos, nYPos, nXPos + nDestWidth, nYPos + nDestHeight);
            CRect rcBack  = new CRect(pBase.ptBase.x, pBase.ptBase.y, pBase.ptBase.x + pBase.nWidth, pBase.ptBase.y + pBase.nHeight);

            if (GameGraphics.IntersectRect(rcImage, rcBack))
            {
                GameGraphics.DrawAlphaImage(g, _bitmap, nXPos - pBase.ptBase.x, nYPos - pBase.ptBase.y, nDestWidth, nDestHeight, nXSource, nYSource, nDestWidth, nDestHeight, tranColor);
            }

            return(true);
        }
Esempio n. 4
0
        //绘画图片
        bool DrawImage(Graphics g, tagBASE pBase, int nXDest, int nYDest, int nDestWidth, int nDestHeight, int nXSource, int nYSource, int nSrcWidth, int nSrcHeight, int cbAlpha)
        {
            if (_bitmap == null)
            {
                return(false);
            }

            CRect rcImage = new CRect(nXDest, nYDest, nXDest + nDestWidth, nYDest + nDestHeight);
            CRect rcBack  = new CRect(pBase.ptBase.x, pBase.ptBase.y, pBase.ptBase.x + pBase.nWidth, pBase.ptBase.y + pBase.nHeight);

            if (GameGraphics.IntersectRect(rcImage, rcBack))
            {
                GameGraphics.DrawImage(g, _bitmap, nXDest - pBase.ptBase.x, nYDest - pBase.ptBase.y, nDestWidth, nDestHeight, nXSource, nYSource, nSrcWidth, nSrcHeight, cbAlpha);
            }

            return(true);
        }