Ejemplo n.º 1
0
void LKBitmapSurface::Create(const LKSurface& Surface, unsigned width, unsigned height) {
#ifdef USE_GDI
    Attach(::CreateCompatibleDC(Surface.GetAttribDC()));
    SetAttribDC(Surface.GetAttribDC());

    _Size = { (LONG)width, (LONG)height };
    _hBitmap = LKBitmap (::CreateCompatibleBitmap(GetAttribDC(), width, height));
    _oldBitmap = LKBitmap((HBITMAP)::SelectObject(_OutputDC, _hBitmap));
#else
    _pCanvas = new BufferCanvas(Surface, {width, height});
#endif    
}
Ejemplo n.º 2
0
void LKBitmapSurface::Resize(unsigned width, unsigned height) {
#ifdef USE_GDI
    if (_oldBitmap) {
        ::SelectObject(_OutputDC, _oldBitmap);
        _oldBitmap.Release();
    }
    if (_hBitmap) {
        _hBitmap.Release();
    }

    _Size = { (LONG)width, (LONG)height };
    _hBitmap = LKBitmap (::CreateCompatibleBitmap(GetAttribDC(), width, height));
    _oldBitmap = LKBitmap((HBITMAP)::SelectObject(_OutputDC, _hBitmap));
#else
    if(_pCanvas) {
        static_cast<BufferCanvas*>(_pCanvas)->Resize({width, height});
    }
#endif
}
Ejemplo n.º 3
0
HDC LKSurface::GetTempDC() {
    if (!_TempDC) {
        _TempDC = ::CreateCompatibleDC(GetAttribDC());
    }
    return _TempDC;
}