// /// Creates a bitmap object for the given device context with the given dib and /// usage argument values. // TBitmap::TBitmap(const TDC& dc, const TDib& dib, uint32 usage) { Handle = ::CreateDIBitmap(dc, (BITMAPINFOHEADER *)dib.GetInfoHeader(), usage, (const uint8 *)dib.GetBits(), (BITMAPINFO *)dib.GetInfo(), dib.Usage()); // API casts WARNX(OwlGDI, !Handle, 0, "Cannot create bitmap from DIB " << hex << (uint)(HANDLE)dib << " for " << (uint)(HDC)dc); CheckValid(); RefAdd(Handle, Bitmap); TRACEX(OwlGDI, OWL_CDLEVEL, "TBitmap constructed @" << (void*)this << " from DIB for " << (uint)(HDC)dc << "."); }
// /// Create a bitmap & get its handle, given a dib and a palette /// Used by ctors here and in derived classes. Assumes Handle member can be /// over written, & adds handle to reference container. // void TBitmap::Create(const TDib& dib, const TPalette& palette) { TScreenDC dc; dc.SelectObject(palette, false); dc.RealizePalette(); Handle = ::CreateDIBitmap( dc, (LPBITMAPINFOHEADER)dib.GetInfoHeader(), CBM_INIT, (const uint8 *)dib.GetBits(), (LPBITMAPINFO)dib.GetInfo(), dib.Usage() ); // API type casts CheckValid(); RefAdd(Handle, Bitmap); }