BITMAPINFO* PainterTextureSample::GetVPDisplayDIB(TimeValue t, TexHandleMaker& thmaker, Interval &valid, BOOL mono, BOOL forceW, BOOL forceH) { // Bitmap *bm; Interval v; Update(t,v); int size = thmaker.Size(); bm = BuildBitmap(size); BITMAPINFO *bmi = thmaker.BitmapToDIB(bm,uvGen->SymFlags(),0,forceW,forceH); // bm->DeleteThis(); valid.SetInfinite(); return bmi; }
Window::Window(uint width, uint height) { hasInit = false; HINSTANCE hInstance = GetModuleHandle( NULL ); WNDCLASSEX windowClass; ZeroMemory(&windowClass, sizeof(WNDCLASSEX)); if(!GetClassInfoEx(hInstance,WINDOWCLASS,&windowClass)) { windowClass.cbSize = sizeof(WNDCLASSEX); windowClass.style = CS_HREDRAW | CS_VREDRAW; windowClass.lpfnWndProc = (WNDPROC)StaticWindowProc; windowClass.hInstance = hInstance; windowClass.hCursor = LoadCursor(NULL, IDC_ARROW); windowClass.hbrBackground = (HBRUSH)COLOR_WINDOW; windowClass.lpszClassName = WINDOWCLASS; if(!RegisterClassEx(&windowClass)) { return; } } windowHandle = CreateWindowEx(NULL, WINDOWCLASS, // name of the window class "Software Rasteriser!", // title of the window WS_OVERLAPPEDWINDOW|WS_POPUP|WS_VISIBLE|WS_SYSMENU|WS_MAXIMIZEBOX|WS_MINIMIZEBOX, // window style (int)100, // x-position of the window (int)100, // y-position of the window (int)width, // width of the window (int)height, // height of the window NULL, // No parent window! NULL, // No Menus! hInstance, // application handle this); // deviceContext=GetDC(windowHandle); RECT rt; GetClientRect(windowHandle, &rt); screenWidth = rt.right; screenHeight = rt.bottom; BuildBitmap(); Keyboard::Initialise(windowHandle); Mouse::Initialise(windowHandle); hasInit = true; forceQuit = false; }
BITMAPINFO* Gradient::GetVPDisplayDIB(TimeValue t, TexHandleMaker& thmaker, Interval &valid, BOOL mono, BOOL forceW, BOOL forceH) { Bitmap* bm = NULL; Interval v; Update(t,v); bm = BuildBitmap(thmaker.Size()); BITMAPINFO *bmi = thmaker.BitmapToDIB(bm,uvGen->SymFlags(),0,forceW,forceH); bm->DeleteThis(); valid.SetInfinite(); Color ac; pblock->GetValue( grad_color1, t, ac, valid ); pblock->GetValue( grad_color2, t, ac, valid ); pblock->GetValue( grad_color3, t, ac, valid ); return bmi; }
//////////////////////////////////////////////////////////// // TBitmap256Control // ----------------- // Select a new bitmap in the control. First build the bitmap // data by calling the virtual function BuildBitmapData, then // calc. the bitmap palette and create the bitmap GDI object. // Then call AdjustWindowSize and DisplayBitmap. void TBitmap256Control::SelectBitmap (const char *name, SHORT remapPlayer, int palnum) { char buf[MAX_PATH]; assert(pUsedColors != NULL); // Save GDI object and set WAIT cursor SELECT_WAIT_CURSOR(); // Free all previous bitmap ressources if ( pBitmapData != NULL ) FreeMemory (pBitmapData); if ( pDIBInfo != NULL ) FreeMemory (pDIBInfo); delete pBitmapPalette; pBitmapPalette = NULL; // Copy name of the new bitmap strcpy(BitmapName, name); // Delete array of used color entry pUsedColors[0] = TRUE; // always use BLACK (for background) for (int i = 1; i < 256 ; i++) pUsedColors[i] = FALSE; // call virtual function of derived class to build bitmap data // TRACE ("TBitmap256Controll::SelectBitmap(): call BuildBitmapData"); sprintf(buf, "%s\\%s", BitmapDir, name); BuildBitmapData (buf, remapPlayer); // Maybe there's no bitmap! (EX: sounds in heretic) if ( pBitmapData != NULL ) { // Load DOOM palette asked LoadDoomPalette (palnum); // Create logical palette of used colors BuildBitmapPalette (); // Build bitmap GDI object BuildBitmap (); } // Adjust window size and scroller range, and display bitmap AdjustWindowSize (); Invalidate(); UpdateWindow(); // Repaint NOW! // Restore cursor UNSELECT_WAIT_CURSOR(); }
void CCredits::OnPaint() { CPaintDC dc(this); // device context for painting CString out; // int i; int line = 0; // TODO: Add your message handler code here //CFont* oldFont = dc.SelectObject(&font); GetClientRect(&crRect); if (virgin) { // create the credits bitmap CDC bdc; //CDC* wdc; virgin = FALSE; //wdc = GetDC(); bdc.CreateCompatibleDC(&dc); creditsHeight = lineCount * LINEHEIGHT + crRect.Height(); bm.CreateCompatibleBitmap(&bdc, CR_WIDTH, creditsHeight); CBitmap *oldbm = bdc.SelectObject(&bm); BuildBitmap(&bdc); bdc.SelectObject(oldbm); //ReleaseDC(wdc); } if (!timer) SetTimer(32, 30, NULL); timer = TRUE; CDC bdc; bdc.CreateCompatibleDC(&dc); CBitmap *obm = bdc.SelectObject(&bm); dc.BitBlt(0, 0, crRect.Width(), crRect.Height(), &bdc, 0, scrollofs, SRCCOPY); // dc.SelectObject(obm); // Do not call CStatic::OnPaint() for painting messages bdc.SelectObject(obm); //ReleaseDC(&bdc); //dc.SelectObject(oldFont); }
DWORD UVtex::GetActiveTexHandle(TimeValue t, TexHandleMaker& thmaker) { #endif if (texHandle) { if (texHandleValid.InInterval(t)) return texHandle->GetHandle(); else DiscardTexHandle(); } Interval v; Update(t,v); Bitmap *bm; bm = BuildBitmap(thmaker.Size()); texHandle = thmaker.CreateHandle(bm); bm->DeleteThis(); texHandleValid.SetInfinite(); int i; pblock->GetValue(uv_uvchannel, t, i, texHandleValid); pblock->GetValue(uv_rtype, t, i, texHandleValid); pblock->GetValue(uv_gtype, t, i, texHandleValid); pblock->GetValue(uv_btype, t, i, texHandleValid); pblock->GetValue(uv_rcount, t, i, texHandleValid); pblock->GetValue(uv_gcount, t, i, texHandleValid); pblock->GetValue(uv_bcount, t, i, texHandleValid); float f; pblock->GetValue(uv_tintAmount, t, f, texHandleValid); pblock->GetValue(uv_rAmount, t, f, texHandleValid); pblock->GetValue(uv_gAmount, t, f, texHandleValid); pblock->GetValue(uv_bAmount, t, f, texHandleValid); Color c; pblock->GetValue(uv_tintColor, t, c, texHandleValid); BOOL b; pblock->GetValue(uv_clampUVW, t, b, texHandleValid); return texHandle->GetHandle(); }
LRESULT Window::WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case(WM_CREATE):{ Window* w = reinterpret_cast<Window*>(((LPCREATESTRUCT)lParam)->lpCreateParams); SetWindowLongPtr(hWnd,GWL_USERDATA,reinterpret_cast<long>(w)); }break; case(WM_DESTROY): { PostQuitMessage(0); forceQuit = true; }break; case (WM_ACTIVATE): { if(LOWORD(wParam) == WA_INACTIVE) { ReleaseCapture(); ClipCursor(NULL); if (hasInit) { Mouse::instance->Sleep(); Mouse::instance->Sleep(); } } else{ if(hasInit) { Mouse::instance->Wake(); Mouse::instance->Wake(); } } return 0; }break; case (WM_LBUTTONDOWN): { }break; case (WM_MOUSEMOVE): { TRACKMOUSEEVENT tme; tme.cbSize = sizeof(TRACKMOUSEEVENT); tme.dwFlags = TME_LEAVE; tme.hwndTrack = windowHandle; TrackMouseEvent(&tme); }break; case(WM_SIZE): { screenWidth = LOWORD(lParam); screenHeight = HIWORD(lParam); BuildBitmap(); Resize(); }break; case(WM_SETFOCUS) : { if (hasInit) { Mouse::instance->Wake(); Mouse::instance->Wake(); } }break; case(WM_KILLFOCUS) : { if (hasInit) { Mouse::instance->Sleep(); Mouse::instance->Sleep(); } }break; } return DefWindowProc (hWnd, message, wParam, lParam); }
void Storage::ViewStreamBuffer() const { VIEW_INFO("Storage::ViewStreamBuffer - LocalBitmap " << GetMinIndex() << " " << GetMaxIndex() << " " << BuildBitmap().GetResourceString() << " End"); }