示例#1
0
void LKSurface::DrawBitmap(const int x, const int y, const int cx, const int cy, const LKBitmap& Bitmap, const int cxSrc, const int cySrc) {
#ifdef USE_GDI
    HGDIOBJ old = ::SelectObject(GetTempDC(), (HBITMAP) Bitmap);

    if (cxSrc != cx || cySrc != cy) {
        ::StretchBlt(*this, x, y, cx, cy, GetTempDC(), 0, 0, cxSrc, cySrc, SRCPAINT);
    } else {
        ::BitBlt(*this, x, y, cx, cy, GetTempDC(), 0, 0, SRCPAINT);
    }

    ::SelectObject(GetTempDC(), old);
#elif defined(ENABLE_OPENGL)
    if(_pCanvas && Bitmap.IsDefined()) {
        _pCanvas->Stretch(x, y, cx, cy, Bitmap, 0, 0, cxSrc, cySrc);
    }
#else
    if(_pCanvas && Bitmap.IsDefined()) {
        if (cxSrc != cx || cySrc != cy) {
            _pCanvas->StretchOr(x, y, cx, cy, Bitmap, 0, 0, cxSrc, cySrc);
        } else {
            _pCanvas->CopyOr(x, y, cx, cy, Bitmap, 0, 0);
        }
    }
#endif    
}
示例#2
0
void LKSurface::DrawBitmap(const int x, const int y, const int cx, const int cy, const LKBitmap& Bitmap) {
#ifdef WIN32
    HGDIOBJ old = ::SelectObject(GetTempDC(), (HBITMAP) Bitmap);
    ::BitBlt(*this, x, y, cx, cy, GetTempDC(), 0, 0, SRCPAINT);
    ::SelectObject(GetTempDC(), old);
#elif defined(ENABLE_OPENGL)
    if(_pCanvas && Bitmap.IsDefined()) {
        _pCanvas->Stretch(x, y, cx, cy, Bitmap, 0, 0, cx, cy);
    }
#else
    if(_pCanvas && Bitmap.IsDefined()) {
        _pCanvas->CopyOr(x, y, cx, cy, Bitmap, 0, 0);
    }
#endif    
}
示例#3
0
void LKSurface::DrawMaskedBitmap(const int x, const int y, const int cx, const int cy, const LKBitmap& Bitmap, const int cxSrc, const int cySrc) {
#ifdef WIN32
    HGDIOBJ old = ::SelectObject(GetTempDC(), (HBITMAP) Bitmap);

    if (cxSrc != cx || cySrc != cy) {
        ::StretchBlt(*this, x, y, cx, cy, GetTempDC(), 0, 0, cxSrc, cySrc, SRCPAINT);
        ::StretchBlt(*this, x, y, cx, cy, GetTempDC(), cxSrc, 0, cxSrc, cySrc, SRCAND);
    } else {
        ::BitBlt(*this, x, y, cx, cy, GetTempDC(), 0, 0, SRCPAINT);
        ::BitBlt(*this, x, y, cx, cy, GetTempDC(), cxSrc, 0, SRCAND);
    }

    ::SelectObject(GetTempDC(), old);
#else
    if(_pCanvas && Bitmap.IsDefined()) {
        if (cxSrc != cx || cySrc != cy) {
            _pCanvas->StretchOr(x, y, cx, cy, Bitmap, 0, 0, cxSrc, cySrc);
            _pCanvas->StretchAnd(x, y, cx, cy, Bitmap, cxSrc, 0, cxSrc, cySrc);
        } else {
            _pCanvas->CopyOr(x, y, cx, cy, Bitmap, 0, 0);
            _pCanvas->CopyAnd(x, y, cx, cy, Bitmap, cxSrc, 0);
        }
    }
#endif
}
示例#4
0
void LKSurface::DrawBitmapCopy(const int x, const int y, const int cx, const int cy, const LKBitmap& Bitmap) {
#ifdef USE_GDI
    HGDIOBJ old = ::SelectObject(GetTempDC(), (HBITMAP) Bitmap);
    ::BitBlt(*this, x, y, cx, cy, GetTempDC(), 0, 0, SRCCOPY);
    ::SelectObject(GetTempDC(), old);
#else
    if(_pCanvas && Bitmap.IsDefined()) {
        _pCanvas->Copy(x, y, cx, cy, Bitmap, 0, 0);
    }
#endif    
}