Exemplo n.º 1
0
/*
 * Here we do the actual rendering. I put it in a separate
 * method so that it can work no matter what type of DC
 * (e.g. wxPaintDC or wxClientDC) is used.
 */
void
wxImagePanel::render(wxDC& dc)
{
  int neww, newh;

  dc.GetSize(&neww, &newh);
  // Adjust aspect ratio.
  if (BackgroundWidth * newh > neww * BackgroundHeight)
    newh = (neww * BackgroundHeight) / BackgroundWidth;
  else
    neww = (newh * BackgroundWidth) / BackgroundHeight;

  if (neww != w || newh != h)
    {
      //static int Count = 0;
      //printf ("Rescale %d: %d %d -> %d %d\n", ++Count, w, h, neww, newh);
      w = neww;
      h = newh;
      resized = wxBitmap(image.Scale(neww, newh, wxIMAGE_QUALITY_HIGH));
      int i;
      for (i = 1; i < NumGraphics; i++) // Skip initial dummy entry.
        Rescale(Graphics[i].UnscaledImage, Graphics[i].ScaledImage);
      for (i = 0; i < MAX_CLOCK_ANGLES; i++)
        {
          Rescale(HandsHours[i].UnscaledImage, HandsHours[i].ScaledImage);
          Rescale(HandsMinutes[i].UnscaledImage, HandsMinutes[i].ScaledImage);
          Rescale(HandsSeconds[i].UnscaledImage, HandsSeconds[i].ScaledImage);
        }
    }
  wxMemoryDC wdc(resized);
  wxBitmap Buffer(resized.GetWidth(), resized.GetHeight());
  wxMemoryDC bdc(Buffer);
  bdc.DrawBitmap(resized, 0, 0, false);
  int i;
  for (i = 0; i < NumFields; i++)
    if (Fields[i].Type == FT_OUT && Fields[i].State != gi_none)
      BufferedComposite(&bdc, Graphics[Fields[i].State].ScaledImage,
          Fields[i].x, Fields[i].y);
  // Do the accutron clock hands.
  time_t t;
  struct tm *tm_struct;
  time(&t);
  tm_struct = gmtime(&t);
  /*
   printf("%d %d %d %d %d %p %p %p\n", Fields[trs_ac_hands].x,
   Fields[trs_ac_hands].y, tm_struct->tm_hour * 5, tm_struct->tm_min * 2,
   tm_struct->tm_sec * 2, HandsHours[tm_struct->tm_hour * 5].ScaledImage,
   HandsMinutes[tm_struct->tm_min * 2].ScaledImage,
   HandsSeconds[tm_struct->tm_sec * 2].ScaledImage);
   */
  BufferedComposite(&bdc, HandsHours[tm_struct->tm_hour * 5].ScaledImage,
      Fields[trs_ac_hands].x, Fields[trs_ac_hands].y);
  BufferedComposite(&bdc, HandsMinutes[tm_struct->tm_min * 2].ScaledImage,
      Fields[trs_ac_hands].x, Fields[trs_ac_hands].y);
  BufferedComposite(&bdc, HandsSeconds[tm_struct->tm_sec * 2].ScaledImage,
      Fields[trs_ac_hands].x, Fields[trs_ac_hands].y);
  // Now actually write the buffer to the screen.
  dc.DrawBitmap(Buffer, 0, 0, false);
}
Exemplo n.º 2
0
void WSortView::RepaintNow()
{
    if (!IsShownOnScreen()) return;

    wxClientDC dc(this);
    wxBufferedDC bdc(&dc, GetSize(), wxBUFFER_CLIENT_AREA);
    paint(bdc, GetSize());
}
Exemplo n.º 3
0
/*
 * WxPanel1UpdateUI
 */
void NumberChoiceDialog::WxPanel1UpdateUI(wxUpdateUIEvent& event)
{
	wxImage image("Images/scroll.jpg");
	wxBitmap tlo(image);
	wxClientDC dc(WxPanel1);
	wxBufferedDC bdc(&dc);
	bdc.DrawBitmap(tlo,0,0,true);
}
Exemplo n.º 4
0
void RenderCanvas::OnDraw(wxDC& dc)
{
   if(m_image != NULL && m_image->IsOk())
      wxBufferedDC bdc(&dc, *m_image);
}
Exemplo n.º 5
0
void PaintDrawPanel::PaintNow()
{
	wxClientDC dc(this);
	wxBufferedDC bdc(&dc, mBitmap);
	Render(bdc);
}