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


C++ Pen类代码示例

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


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


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