• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ Pen类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Pen的典型用法代码示例。如果您正苦于以下问题:C++ Pen类的具体用法?C++ Pen怎么用?C++ Pen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: WriteWithPen

void WriteWithPen(Pen &pen){

cout << pen.drawLine() << endl;

cout << pen.drawCircle() << endl;

 }
开发者ID:Tigana12,项目名称:ASSIGNMENT-3,代码行数:7,代码来源:main(Fountain+Pen).cpp


示例2: Pen_setHsva

/** void Pen::setHsva(float h, float s=1.0, float v=1.0, float a=1.0)
 * include/mimas/Pen.h:69
 */
static int Pen_setHsva(lua_State *L) {
  try {
    Pen *self = *((Pen **)dub_checksdata(L, 1, "mimas.Pen"));
    int top__ = lua_gettop(L);
    if (top__ >= 5) {
      float h = dub_checknumber(L, 2);
      float s = dub_checknumber(L, 3);
      float v = dub_checknumber(L, 4);
      float a = dub_checknumber(L, 5);
      self->setHsva(h, s, v, a);
      return 0;
    } else if (top__ >= 4) {
      float h = dub_checknumber(L, 2);
      float s = dub_checknumber(L, 3);
      float v = dub_checknumber(L, 4);
      self->setHsva(h, s, v);
      return 0;
    } else if (top__ >= 3) {
      float h = dub_checknumber(L, 2);
      float s = dub_checknumber(L, 3);
      self->setHsva(h, s);
      return 0;
    } else {
      float h = dub_checknumber(L, 2);
      self->setHsva(h);
      return 0;
    }
  } catch (std::exception &e) {
    lua_pushfstring(L, "setHsva: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "setHsva: Unknown exception");
  }
  return dub_error(L);
}
开发者ID:lubyk,项目名称:mimas,代码行数:37,代码来源:mimas_Pen.cpp


示例3: setDirty

CompiledTextStyle Text::textStyle()
{
    if(isDirty()) {
        setDirty(false);
        {
			QVariant v = basedOn();
			if(v.isValid()) {
                QObject *o = styleobjectFromVariant(v);
				Text *based_on = qobject_cast<Text*>(o);
                if(based_on) {
                    m_textStyle = based_on->textStyle();
                }
			}
		}
		{
			Pen* p = pen();
			if(p) {
				m_textStyle.setPen(p->pen());
			}
		}
		{
			Font* p = font();
			if(p) {
				m_textStyle.setFont(p->font());
			}
		}
	}
    return m_textStyle;
}
开发者ID:Nechanicky,项目名称:quickbox,代码行数:29,代码来源:text.cpp


示例4: RECT2Rect

VOID Button::draw(Graphics *pGraphics, Pen &rPen, SolidBrush &rBrush, CONST Font &/*rFont*/) const
{
	rPen.SetColor(Color(5, 159, 225));
	rPen.SetWidth(3);
	rBrush.SetColor(Color(255, 125, 34));
	
	pGraphics->DrawRectangle(&rPen, RECT2Rect());
	//graphics->DrawString(text_.c_str(), text_.length(), &font, PointF(RECT2RectF().GetLeft(), RECT2RectF().GetTop()), &brush);
}
开发者ID:MyLibh,项目名称:Billiards,代码行数:9,代码来源:Button.cpp


示例5: DrawPolyline

static void
DrawPolyline(Canvas &canvas, PixelOperations operations, const Pen &pen,
             const BulkPixelPoint *lppt, unsigned n_points,
             bool loop)
{
  const unsigned thickness = pen.GetWidth();
  const unsigned mask = pen.GetMask();
  const auto color = canvas.Import(pen.GetColor());

  canvas.DrawPolyline(lppt, n_points, loop, color, thickness, mask);
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:11,代码来源:Canvas.cpp


示例6: Point

VOID vec::draw(double x0, double y0, Graphics *graphics, Pen &rPen, CONST Color &rColor /* = Color::Yellow */) const
{
	rPen.SetColor(rColor);
	rPen.SetWidth(2);

    graphics->DrawLine(&rPen, Point(static_cast<INT>(x0     ), static_cast<INT>(     y0)), Point(static_cast<INT>(x0 + x_), static_cast<INT>(y_ + y0)));
    graphics->DrawLine(&rPen, Point(static_cast<INT>(x0 + x_), static_cast<INT>(y_ + y0)), Point(static_cast<INT>(x0 + x_ - ((l_ < 0)? -1 : 1) * 5 * cos(k_ + M_PI_4)), static_cast<INT>(y_ + y0 - ((l_ < 0)? -1 : 1) * 5 * sin(k_ + M_PI_4))));
    graphics->DrawLine(&rPen, Point(static_cast<INT>(x0 + x_), static_cast<INT>(y_ + y0)), Point(static_cast<INT>(x0 + x_ - ((l_ < 0)? -1 : 1) * 5 * cos(k_ - M_PI_4)), static_cast<INT>(y_ + y0 - ((l_ < 0)? -1 : 1) * 5 * sin(k_ - M_PI_4))));

    l_ = sqrt(x_ * x_ + y_ * y_);
    k_ = atan_(x_, y_);
}
开发者ID:MyLibh,项目名称:Billiards,代码行数:12,代码来源:Vector.cpp


示例7: Pen_setWidth

/** void Pen::setWidth(float w)
 * include/mimas/Pen.h:57
 */
static int Pen_setWidth(lua_State *L) {
  try {
    Pen *self = *((Pen **)dub_checksdata(L, 1, "mimas.Pen"));
    float w = dub_checknumber(L, 2);
    self->setWidth(w);
    return 0;
  } catch (std::exception &e) {
    lua_pushfstring(L, "setWidth: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "setWidth: Unknown exception");
  }
  return dub_error(L);
}
开发者ID:lubyk,项目名称:mimas,代码行数:16,代码来源:mimas_Pen.cpp


示例8: Pen_setColor

/** void Pen::setColor(const Color &color)
 * include/mimas/Pen.h:65
 */
static int Pen_setColor(lua_State *L) {
  try {
    Pen *self = *((Pen **)dub_checksdata(L, 1, "mimas.Pen"));
    Color *color = *((Color **)dub_checksdata(L, 2, "mimas.Color"));
    self->setColor(*color);
    return 0;
  } catch (std::exception &e) {
    lua_pushfstring(L, "setColor: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "setColor: Unknown exception");
  }
  return dub_error(L);
}
开发者ID:lubyk,项目名称:mimas,代码行数:16,代码来源:mimas_Pen.cpp


示例9: gdiplusCreatePen

static Pen * gdiplusCreatePen(UINT style, float width, COLORREF color)
{
	// create GDI+ pen
	Color gdipColor(0, 0, 0, 255);
	gdipColor.SetFromCOLORREF(color);
	Pen * pen = new Pen(gdipColor, width > 1 ? width : 1);
	if (style <= PS_DASHDOTDOT)
		// cast is save since GDI and GDI+ use same numbers
		pen->SetDashStyle(static_cast<DashStyle>(style));
	pen->SetLineCap(LineCapFlat, LineCapFlat, DashCapFlat);

	return pen;
}
开发者ID:EdwardGHub,项目名称:Scripts,代码行数:13,代码来源:wgdiplus.cpp


示例10: DrawPolyline

static void
DrawPolyline(Canvas &canvas, PixelOperations operations, const Pen &pen,
             const RasterPoint *lppt, unsigned n_points,
             bool loop)
{
  const unsigned thickness = pen.GetWidth();
  const unsigned mask = pen.GetMask();
  const auto color = canvas.Import(pen.GetColor());

  const SDLRasterCanvas::Point *points =
    reinterpret_cast<const SDLRasterCanvas::Point *>(lppt);
  canvas.DrawPolyline(points, n_points, loop, color, thickness, mask);
}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:13,代码来源:Canvas.cpp


示例11: Pen_setJoinStyle

/** void Pen::setJoinStyle(int style)
 * include/mimas/Pen.h:83
 */
static int Pen_setJoinStyle(lua_State *L) {
  try {
    Pen *self = *((Pen **)dub_checksdata(L, 1, "mimas.Pen"));
    int style = dub_checkint(L, 2);
    self->setJoinStyle(style);
    return 0;
  } catch (std::exception &e) {
    lua_pushfstring(L, "setJoinStyle: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "setJoinStyle: Unknown exception");
  }
  return dub_error(L);
}
开发者ID:lubyk,项目名称:mimas,代码行数:16,代码来源:mimas_Pen.cpp


示例12: oglcontext

void  Opengl2dPainter::renderBegin(Pen& pen, Matrix3& matrix)
{
    OpenglContext oglcontext(_pPimpl->hdc, _pPimpl->hrc);

    glClearColor(pen.color().r/ 255.0, pen.color().g/255.0, pen.color().b/255.0, 0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    Matrix3 m;
    m.Rotate( _pPimpl->angle);
    _pPimpl->worldMatrix = matrix * m;
}
开发者ID:sepwind,项目名称:kami2d,代码行数:13,代码来源:opengl2dpainter.cpp


示例13: paintTile

bool Screen::paintTile(const Pen &pen, int x, int y, bool map)
{
    if (!gps || !pen.valid()) return false;

    doSetTile(pen, x, y, map);
    return true;
}
开发者ID:fschumann1211,项目名称:dfhack,代码行数:7,代码来源:Screen.cpp


示例14: draw

VOID Cue::draw(Graphics *pGraphics, Pen &rPen, Image &rCue) const
{	
	auxiliaryLine_.draw((ball_ - auxiliaryLine_).getX(), (ball_ - auxiliaryLine_).getY(), pGraphics, rPen, static_cast<ARGB>(Color::Gray));

	rPen.SetColor(static_cast<ARGB>(Color::Gray));
	rPen.SetWidth(3);
	pGraphics->DrawEllipse(&rPen, static_cast<INT>(mouse_.getX() - RShari), static_cast<INT>(mouse_.getY() - RShari), RShari * 2, RShari * 2);

	pGraphics->TranslateTransform(static_cast<REAL>(ball_.getX()), static_cast<REAL>(ball_.getY()));
	pGraphics->RotateTransform(angle_); 
	
	ImageAttributes imAttr;
	imAttr.SetColorKey(COLOR_KEY, COLOR_KEY);		
	pGraphics->DrawImage(&rCue, Rect(static_cast<INT>(-884 - force_ * 8), static_cast<INT>(-20 / 2), 884 * 2, 20), 0, 0, 884 * 2, 20, Unit::UnitPixel, &imAttr, 0);

	pGraphics->ResetTransform();
}
开发者ID:MyLibh,项目名称:Billiards,代码行数:17,代码来源:Cue.cpp


示例15: DrawPolygon

void DrawPolygon(const Point* points, IN INT count, HDC hdcPaint, DashStyle dashStyle, Color clr, REAL width)
{
    Pen*         myPen;
    Graphics*    myGraphics;
    myPen = new Pen(clr, width);
    if(myPen)
    {
        myPen->SetDashStyle(dashStyle);
        myGraphics = new Graphics(hdcPaint);
        if(myGraphics)
        {
            myGraphics->DrawPolygon(myPen, points, count);
            delete myGraphics;
        }
        delete myPen;
    }
}
开发者ID:sakbhav,项目名称:PassWd_Mgr,代码行数:17,代码来源:aerosubc.cpp


示例16: DrawLine

void DrawLine(const Point &pt1, const Point &pt2, HDC hdcPaint, DashStyle dashStyle, Color clr, REAL width)
{
    Pen*         myPen;
    Graphics*    myGraphics;
    myPen = new Pen(clr, width);
    if(myPen)
    {
        myPen->SetDashStyle(dashStyle);
        myGraphics = new Graphics(hdcPaint);
        if(myGraphics)
        {
            myGraphics->DrawLine(myPen, pt1, pt2);
            delete myGraphics;
        }
        delete myPen;
    }
}
开发者ID:sakbhav,项目名称:PassWd_Mgr,代码行数:17,代码来源:aerosubc.cpp


示例17: DrawRect

void DrawRect(LPRECT prc, HDC hdcPaint, DashStyle dashStyle, Color clr, REAL width)
{
    Pen*         myPen;
    Graphics*    myGraphics;
    myPen = new Pen(clr, width);
    if(myPen)
    {
        myPen->SetDashStyle(dashStyle);
        myGraphics = new Graphics(hdcPaint);
        if(myGraphics)
        {
            myGraphics->DrawRectangle(myPen, prc->left, prc->top, 
                prc->right - 1 - prc->left, prc->bottom - 1 - prc->top);
            delete myGraphics;
        }
        delete myPen;
    }
}
开发者ID:sakbhav,项目名称:PassWd_Mgr,代码行数:18,代码来源:aerosubc.cpp


示例18: paintTile

bool Screen::paintTile(const Pen &pen, int x, int y)
{
    if (!gps || !pen.valid()) return false;

    auto dim = getWindowSize();
    if (x < 0 || x >= dim.x || y < 0 || y >= dim.y) return false;

    doSetTile(pen, x*dim.y + y);
    return true;
}
开发者ID:maxthyme,项目名称:dfhack,代码行数:10,代码来源:Screen.cpp


示例19: assert

void
ChartRenderer::DrawLine(const double xmin, const double ymin,
                        const double xmax, const double ymax, const Pen &pen)
{
  if (x.unscaled || y.unscaled)
    return;

  assert(pen.IsDefined());
  canvas.Select(pen);
  canvas.DrawLine(ToScreen(xmin, ymin), ToScreen(xmax, ymax));
}
开发者ID:kwtskran,项目名称:XCSoar,代码行数:11,代码来源:ChartRenderer.cpp


示例20: canvas

void
Canvas::DrawOutlineRectangle(int left, int top, int right, int bottom,
                             const Pen& pen)
{
  SDLRasterCanvas canvas(buffer);
  const int x1 = left+pen.GetWidth()/2;
  const int y1 = top+pen.GetWidth()/2;
  const int x2 = right-(pen.GetWidth()+1)/2;
  const int y2 = bottom-(pen.GetWidth()+1)/2;
  
  canvas.DrawThickLine(x1, y1, x2, y1, pen.GetWidth(), canvas.Import(pen.GetColor()), pen.GetMask());
  canvas.DrawThickLine(x1, y2, x2, y2, pen.GetWidth(), canvas.Import(pen.GetColor()), pen.GetMask());
  canvas.DrawThickLine(x1, y1, x1, y2, pen.GetWidth(), canvas.Import(pen.GetColor()), pen.GetMask());
  canvas.DrawThickLine(x2, y1, x2, y2, pen.GetWidth(), canvas.Import(pen.GetColor()), pen.GetMask());
}
开发者ID:jaaaaf,项目名称:LK8000,代码行数:15,代码来源:Canvas.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PerfCounter类代码示例发布时间:2022-05-31
下一篇:
C++ PassManagerBuilder类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap