int FBSD_ShutdownGraphics(void) {
  
  /* If StartupGraphics() fails, it leaves a big piece of shit */
  /* Trying to take it away */
  
   if (VGAInfo.flags & PALETTE_SAVED) 
   RestorePalette();

  if (VGAInfo.flags & GRAPH_MODE) 
   ioctl(VGAInfo.fd,FBIO_SETMODE,&VGAInfo.oldmode);

  if (VGAInfo.flags & KBD_RAWMODE) {
    ioctl(VGAInfo.fd,KDSKBMODE,VGAInfo.oldkmode);
  }

  if (VGAInfo.flags & TTY_STARTED) 
    tcsetattr(VGAInfo.fd,TCSANOW,&VGAInfo.oti);

  if (VGAInfo.flags & CONS_ACTIVE) 
    ioctl(VGAInfo.fd,VT_ACTIVATE,VGAInfo.consnum);

  if (VGAInfo.flags & FB_MAPPED) 
    munmap(VGAInfo.lfb,0x10000);

  close(VGAInfo.fd);
  
  freeallsigs();
  
  VGAInfo.flags=0;

  return 0; 
}
void CardWindow::Paint(HDC hdc)
{
    int i;
    RECT rect;
    HPALETTE hOldPal;

    hOldPal = UseNicePalette(hdc, __hPalette);

    //
    //    Clip the card stacks so that they won't
    //    get painted over
    //
    for(i = 0; i < nNumCardRegions; i++)
    {
        Regions[i]->Clip(hdc);
    }

    //
    //    Clip the buttons
    //
    for(i = 0; i < nNumButtons; i++)
    {
        Buttons[i]->Clip(hdc);
    }


    //    Now paint the whole screen with background colour,
    //
    GetClientRect(m_hWnd, &rect);

    //PaintRect(hdc, &rect, MAKE_PALETTERGB(crBackgnd));
    PaintCardRgn(hdc, 0, 0, rect.right, rect.bottom, 0, 0);
    SelectClipRgn(hdc, NULL);

    //    Don't let cards draw over buttons, so clip buttons again
    //
    for(i = 0; i < nNumButtons; i++)
    {
        Buttons[i]->Clip(hdc);
    }

    //    Paint each card stack in turn
    //
    for(i = 0; i < nNumCardRegions; i++)
    {
        Regions[i]->Render(hdc);
    }

    //    Paint each button now
    //
    SelectClipRgn(hdc, NULL);

    for(i = 0; i < nNumButtons; i++)
    {
        Buttons[i]->Redraw();
    }

    RestorePalette(hdc, hOldPal);
}
Beispiel #3
0
void CardButton::Redraw()
{
    HDC hdc = GetDC((HWND)parentWnd);

    HPALETTE hOldPal = UseNicePalette(hdc, __hPalette);

    Draw(hdc, !fButtonDown);

    RestorePalette(hdc, hOldPal);

    ReleaseDC((HWND)parentWnd, hdc);
}
void CardWindow::SetBackColor(COLORREF cr)
{
    crBackgnd = cr;
    int i;

    //
    // Create the exact palette we need to render the buttons/stacks
    //
    RestorePalette(__hdcPlaceHolder, __holdplacepal);

    if(__hPalette)
        DeleteObject(__hPalette);

    __hPalette = CreateCardPalette();

    //
    // re-create the place-holder!
    HDC hdc = GetDC(m_hWnd);

    DeleteObject(__hbmPlaceHolder);

    __holdplacepal = UseNicePalette(__hdcPlaceHolder, __hPalette);

    __hbmPlaceHolder = CreateSinkBmp(hdc, __hdcPlaceHolder, crBackgnd, __cardwidth, __cardheight);
    //SelectObject(__hdcPlaceHolder, __hbmPlaceHolder);

    //reset all buttons to same colour
    for(i = 0; i < nNumButtons; i++)
    {
        if(Buttons[i]->GetStyle() & CB_PUSHBUTTON)
        {
            Buttons[i]->SetBackColor(ColorScaleRGB(crBackgnd, RGB(255,255,255), 0.1));
        }
        else
        {
            Buttons[i]->SetBackColor(crBackgnd);
        }
    }

    for(i = 0; i < nNumCardRegions; i++)
    {
        Regions[i]->SetBackColor(crBackgnd);
    }


    ReleaseDC(m_hWnd, hdc);
}
CardWindow::~CardWindow()
{
    if(m_hWnd)
        DestroyWindow(m_hWnd);

    DeleteAll();

    if(0 == InterlockedDecrement(&uCardBitmapRef))
    {
        FreeCardBitmaps();

        DeleteObject(__hbmPlaceHolder);
        DeleteDC    (__hdcPlaceHolder);

        RestorePalette(__hdcPlaceHolder, __holdplacepal);

        if(__hPalette)
            DeleteObject(__hPalette);
    }
}