#include "WindowPixelManager.h" namespace LifeCore { WindowPixelManager::WindowPixelManager(WindowWin* wnd, int bpp) :window(wnd) { hwnd = (HWND)(window->GetWindowHandle()); ::ZeroMemory(&bitmapInfo, sizeof(BITMAPINFOHEADER)); bitmapInfo.biSize = sizeof(BITMAPINFOHEADER); bitmapInfo.biWidth = wnd->GetWidth(); bitmapInfo.biHeight = -wnd->GetHeight(); bitmapInfo.biPlanes = 1; bitmapInfo.biBitCount = bpp; bitmapInfo.biCompression = 0; bitmapInfo.biSizeImage = wnd->GetWidth() * wnd->GetHeight() * (bpp / 8); info.bmiHeader = bitmapInfo; context = ::GetDC(hwnd); } void WindowPixelManager::SetPixels(int width, int height, void* pixels) { bitmapInfo.biWidth = width; bitmapInfo.biHeight = -height; bitmapInfo.biSizeImage = width * height * (bitmapInfo.biBitCount / 8); info.bmiHeader = bitmapInfo; SetDIBitsToDevice(context, 0, 0, width, height, 0, 0, 0, height, pixels, &info, 0); } /**/ }