当前位置: 首页>>代码示例>>C++>>正文


C++ Canvas::Copy方法代码示例

本文整理汇总了C++中Canvas::Copy方法的典型用法代码示例。如果您正苦于以下问题:C++ Canvas::Copy方法的具体用法?C++ Canvas::Copy怎么用?C++ Canvas::Copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Canvas的用法示例。


在下文中一共展示了Canvas::Copy方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnPaintBuffer

void
BufferWindow::OnPaint(Canvas &canvas)
{
#ifdef ENABLE_OPENGL
  if (!buffer.IsDefined()) {
    buffer.Create(canvas.GetSize());
    dirty = true;
  }

  if (dirty) {
    dirty = false;
    buffer.Begin(canvas);
    OnPaintBuffer(buffer);
    buffer.Commit(canvas);
  } else
    buffer.CopyTo(canvas);

#else

  if (dirty) {
    dirty = false;
    OnPaintBuffer(buffer);
  }

  canvas.Copy(buffer);
#endif
}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:27,代码来源:BufferWindow.cpp

示例2: new_size

void
TaskMapButtonRenderer::DrawButton(Canvas &canvas, const PixelRect &rc,
                                  gcc_unused bool enabled,
                                  gcc_unused bool focused,
                                  bool pressed) const
{
  if (task == nullptr) {
    canvas.ClearWhite();
    return;
  }

  const PixelSize new_size(rc.right - rc.left,
                           rc.bottom - rc.top);
  if (!IsBufferValid(new_size)) {
    if (!buffer.IsDefined()) {
#ifdef ENABLE_OPENGL
      buffer.Create(new_size);
#else
      buffer.Create(canvas, new_size);
#endif
    } else
      buffer.Grow(new_size);

    size = new_size;

#ifdef ENABLE_OPENGL
    buffer.Begin(canvas);
#endif

    const PixelRect buffer_rc(0, 0, new_size.cx, new_size.cy);
    DrawTask(buffer, buffer_rc, look, *task);

#ifdef ENABLE_OPENGL
    buffer.Commit(canvas);
#endif
  } else {
#ifdef ENABLE_OPENGL
    buffer.CopyTo(canvas);
#endif
  }

#ifndef ENABLE_OPENGL
  canvas.Copy(buffer);
#endif

  if (pressed) {
#ifdef ENABLE_OPENGL
    const ScopeAlphaBlend alpha_blend;
    canvas.DrawFilledRectangle(rc, COLOR_YELLOW.WithAlpha(80));
#else
    canvas.InvertRectangle(rc);
#endif
  }
}
开发者ID:Andy-1954,项目名称:XCSoar,代码行数:54,代码来源:TaskMapButtonRenderer.cpp

示例3: OnPaint

  virtual void OnPaint(Canvas &canvas) override {
#ifndef ENABLE_OPENGL
    if (!buffered) {
#endif
      canvas.ClearWhite();

      paint(canvas);
#ifndef ENABLE_OPENGL
    } else
      canvas.Copy(buffer);
#endif

    SingleWindow::OnPaint(canvas);
  }
开发者ID:Tjeerdm,项目名称:XCSoarDktjm,代码行数:14,代码来源:RunCanvas.cpp

示例4: logo

static void
DrawBanner(Canvas &canvas, PixelRect &rc)
{
  const unsigned padding = 2;
  const Bitmap logo(IDB_LOGO);
  const unsigned banner_height = logo.GetHeight();

  /* draw the XCSoar logo */
  int x = rc.left + padding;
  canvas.Copy(x, rc.top + padding,
              logo.GetWidth(), logo.GetHeight(),
              logo, 0, 0);

  x += logo.GetWidth() + 8;

  canvas.Select(bold_font);
  canvas.SetTextColor(COLOR_BLACK);
  canvas.SetBackgroundTransparent();

  /* draw the XCSoar banner text with a larger font */
  Font large_font;
  large_font.LoadFile("/opt/xcsoar/share/fonts/VeraBd.ttf", 40);
  canvas.Select(large_font);
  const unsigned name_y = rc.top
    + (banner_height - large_font.GetHeight()) / 2;

  const TCHAR *const name1 = _T("XC");
  canvas.DrawText(x, name_y, name1);
  x += canvas.CalcTextWidth(name1);

  const TCHAR *const name2 = _T("Soar");
  canvas.SetTextColor(COLOR_GRAY);
  canvas.DrawText(x, name_y, name2);
  canvas.SetTextColor(COLOR_BLACK);
  x += canvas.CalcTextWidth(name2) + 30;

  /* some more text */
  const TCHAR *const website = _T("www.xcsoar.org");
  canvas.Select(normal_font);
  canvas.DrawText(x, rc.top + (banner_height - normal_font.GetHeight()) / 2,
                  website);

  const TCHAR *const comment = _T("powered off");
  canvas.DrawText(rc.right - canvas.CalcTextWidth(comment) - padding,
                  rc.top + padding, comment);

  rc.top += banner_height + 8;
}
开发者ID:MaxPower-No1,项目名称:XCSoar,代码行数:48,代码来源:PowerOff.cpp

示例5: title

static void
OnLogoPaint(gcc_unused WndOwnerDrawFrame *Sender, Canvas &canvas)
{
  const UPixelScalar width = canvas.GetWidth();
  PixelScalar x = Layout::FastScale(10), y = x;

  canvas.ClearWhite();

  Bitmap title(width > 360 ? IDB_TITLE_HD : IDB_TITLE);

  // Determine title image size
  PixelSize title_size = title.GetSize();

  // Draw 'XCSoar N.N' title
  canvas.Copy(x, y, title_size.cx, title_size.cy, title, 0, 0);
  y += title_size.cy + Layout::FastScale(20);

  Font font;
  font.Load(GetStandardFontFace(), Layout::FastScale(16));
  canvas.Select(font);
  canvas.SetTextColor(COLOR_BLACK);
  canvas.SetBackgroundTransparent();

  canvas.DrawText(x, y, _T("version: "));
  canvas.DrawText(x + Layout::FastScale(80), y, XCSoar_VersionString);
  y += Layout::FastScale(22);

  canvas.DrawText(x, y, _T("date: "));
  canvas.DrawText(x + Layout::FastScale(80), y, _T(__DATE__));
#ifdef GIT_COMMIT_ID
  y += Layout::FastScale(22);

  canvas.DrawText(x, y, _T("git: "));
  canvas.DrawText(x + Layout::FastScale(80), y, _T(GIT_COMMIT_ID));
#endif
  y += Layout::FastScale(37);

  canvas.DrawText(x, y, _T("more information at"));
  y += Layout::FastScale(22);

  canvas.SetTextColor(COLOR_XCSOAR);
  canvas.DrawText(x, y, _T("http://www.xcsoar.org"));
}
开发者ID:MindMil,项目名称:XCSoar,代码行数:43,代码来源:dlgCredits.cpp

示例6: GetCanvasN

void
FPlayer::OnUserEventReceivedN(RequestId requestId, Osp::Base::Collection::IList* pArgs)
{
    if (requestId == THREADCALLBACK_REDRAW) {
        RedrawDisplayBuffer(displaybuffer_->GetBounds());
        if (controlsarevisible == false) {
            Canvas* formCanvas;
            formCanvas = GetCanvasN();
            formCanvas->Copy(Point(canvasredrawrect_.x, canvasredrawrect_.y), *displaybuffer_, canvasredrawrect_);
            formCanvas->Show(canvasredrawrect_);
            delete formCanvas;
        } else {
            this->RequestRedraw();
        }
        /*long long fpsbenchmarktimeold = fpsbenchmarktime;
        Osp::System::SystemTime::GetTicks(fpsbenchmarktime);
        AppLog("render frame %d ms", (int)(fpsbenchmarktime - fpsbenchmarktimeold));*/
        pPlayerThread_->SendUserEvent(pPlayerThread_->THREAD_FRAMEDRAWED, null);
    } else if (requestId == THREADCALLBACK_FILELOADED) {
        delete speedbtnbmpn_;
        delete speedbtnbmps_;
        speedbtnbmpn_ = CreateSpeedBtnBmp(164, Osp::Base::Integer::ToString((int)pPlayerThread_->fileinfo_.playframerate) + L" fps", false);
        speedbtnbmps_ = CreateSpeedBtnBmp(164, Osp::Base::Integer::ToString((int)pPlayerThread_->fileinfo_.playframerate) + L" fps", true);
        speedbtn->SetNormalBackgroundBitmap(*speedbtnbmpn_);
        speedbtn->SetPressedBackgroundBitmap(*speedbtnbmps_);
        this->RequestRedraw();
        if (this->autoplayonload == true) {
            this->OnActionPerformed(*this, APLAYPAUSE);
            /*pPlayerThread_->playing = false;
            pPlayerThread_->SendUserEvent(pPlayerThread_->THREAD_PLAYPAUSE, null);*/
        }
    } else if ((requestId == THREADCALLBACK_EXPORTDONE) || (requestId == THREADCALLBACK_EXPORTPROGRESSUPDATE)) {
        AppLog("player event recived");
        this->OnActionPerformed(*this, requestId);
    }
}
开发者ID:BoboTheRobot,项目名称:Badaprojects,代码行数:36,代码来源:FPlayer.cpp

示例7: protect

void
DoubleBufferWindow::OnPaint(Canvas &canvas)
{
  ScopeLock protect(mutex);
  canvas.Copy(GetVisibleCanvas());
}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:6,代码来源:DoubleBufferWindow.cpp

示例8: lock

void
DoubleBufferWindow::OnPaint(Canvas &canvas)
{
  std::lock_guard<Mutex> lock(mutex);
  canvas.Copy(GetVisibleCanvas());
}
开发者ID:XCSoar,项目名称:XCSoar,代码行数:6,代码来源:DoubleBufferWindow.cpp


注:本文中的Canvas::Copy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。