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


C++ Paint::SetStrokeWidth方法代码示例

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


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

示例1: GetBounds

void TitleBar::MinimizeButton::OnDraw(const Context &context) {
  Canvas *canvas = context.canvas();
  int scale = context.surface()->GetScale();
  const RectF &rect = GetBounds();

  canvas->Scale(scale, scale);

  Paint paint;
  paint.SetAntiAlias(true);

  if (IsHovered()) {
    if (IsPressed()) {
      paint.SetColor(Theme::GetData().title_bar.highlight.foreground.colors[0]);
      paint.SetStyle(Paint::Style::kStyleFill);
      canvas->DrawCircle(rect.center_x(), rect.center_y(), 7.f, paint);
      paint.Reset();
      paint.SetAntiAlias(true);
    }

    paint.SetStyle(Paint::Style::kStyleStroke);
    paint.SetColor(Theme::GetData().title_bar.active.foreground.colors[0]);
    paint.SetStrokeWidth(1.f);
    canvas->DrawCircle(rect.center_x(), rect.center_y(), 6.5f, paint);
  }

  paint.SetColor(Theme::GetData().title_bar.active.foreground.colors[0]);
  paint.SetStrokeWidth(1.5f);
  canvas->DrawLine(rect.center_x() - 4.f, rect.center_y(),
                   rect.center_x() + 4.f, rect.center_y(),
                   paint);
}
开发者ID:lineCode,项目名称:framework,代码行数:31,代码来源:title-bar.cpp

示例2: proprietor

void Spinner::Private::Draw(const Context &context) {
  angle += 5.f;
  if (angle > 360.f) angle = 0.f;

  Canvas *canvas = context.canvas();
  int scale = context.surface()->GetScale();
  canvas->Scale(scale, scale);

  const RectF &rect = proprietor()->GetBounds();
  float radius = base::Clamp(std::min(rect.width(), rect.height()) / 2.f - 50.f,
                             50.f, 200.f);

  Paint paint;
  paint.SetAntiAlias(true);

  paint.SetColor(background);
  paint.SetStyle(Paint::Style::kStyleFill);
  canvas->DrawRect(rect, paint);

  paint.SetColor(ColorF(foreground));
  paint.SetStyle(Paint::Style::kStyleStroke);
  paint.SetStrokeWidth(6.f);

  canvas->DrawArc(RectF(rect.center_x() - radius,
                        rect.center_y() - radius,
                        rect.center_x() + radius,
                        rect.center_y() + radius),
                  angle, 300.f, false, paint);

  frame_callback.Setup(context.surface());
}
开发者ID:lineCode,项目名称:framework,代码行数:31,代码来源:spinner.cpp


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