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

C++ Pen函数代码示例

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

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



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

示例1: Pen

void CDC::DrawExtrusion(const CRect& rRect)
{
	// Draw highlight.
	Pen(GetSysColor(COLOR_BTNHIGHLIGHT));
	Move(rRect.left,    rRect.bottom-1);
	Line(rRect.left,    rRect.top);
	Line(rRect.right-1, rRect.top);

	// Draw shadow.
	Pen(GetSysColor(COLOR_BTNSHADOW));
	Line(rRect.right-1, rRect.bottom-1);
	Line(rRect.left,    rRect.bottom-1);
}
开发者ID:chrisoldwood,项目名称:WIN16,代码行数:13,代码来源:DC.cpp


示例2: GetRValue

void CPropPageFrameDefault::FillGradientRectH(CDC *pDc, const RECT &rect, COLORREF clrLeft, COLORREF clrRight)
{
	// pre calculation
	int	nSteps = rect.right-rect.left;
	int	nRRange = GetRValue(clrRight)-GetRValue(clrLeft);
	int	nGRange = GetGValue(clrRight)-GetGValue(clrLeft);
	int	nBRange = GetBValue(clrRight)-GetBValue(clrLeft);

	double	dRStep = (double)nRRange/(double)nSteps;
	double	dGStep = (double)nGRange/(double)nSteps;
	double	dBStep = (double)nBRange/(double)nSteps;

	double	dR = (double)GetRValue(clrLeft);
	double	dG = (double)GetGValue(clrLeft);
	double	dB = (double)GetBValue(clrLeft);

	CPen	*pPrevPen = NULL;
	for (int x = rect.left; x <= rect.right; ++x)
	{
		CPen	Pen(PS_SOLID, 1, RGB((BYTE)dR, (BYTE)dG, (BYTE)dB));
		pPrevPen = pDc->SelectObject(&Pen);
		pDc->MoveTo(x, rect.top);
		pDc->LineTo(x, rect.bottom);
		pDc->SelectObject(pPrevPen);
		
		dR+= dRStep;
		dG+= dGStep;
		dB+= dBStep;
	}
}
开发者ID:Strongc,项目名称:playasa,代码行数:30,代码来源:PropPageFrameDefault.cpp


示例3: Pen

void LKSurface::DrawLine(Pen::Style PenStyle, const int width, const POINT& ptStart, const POINT& ptEnd, const LKColor& cr, const RECT& rc) {
    LKPen Pen(PenStyle, width, cr);
    const auto OldPen = SelectObject(Pen);

    const POINT pt[2] = {ptStart, ptEnd};
    Polyline(pt, 2, rc);

    SelectObject(OldPen);
}
开发者ID:acasadoalonso,项目名称:LK8000,代码行数:9,代码来源:LKSurface.cpp


示例4: Pen

void crobot::Refresh()
{
    QPen Pen(Qt::black, 5);
    pType->setRect(-(315/2),-(330/2),315,330);
    pType->setRotation(-nAngle);
    pType->setPos(nX,nY);

    pType->setPen(Pen);
}
开发者ID:Clav36,项目名称:Robotech_Gestion_Deplacements,代码行数:9,代码来源:crobot.cpp


示例5: dc

//
// This draws the background of a toolbar
//
void ToolBar::OnPaint( wxPaintEvent & event )
{
   wxPaintDC dc( (wxWindow *) event.GetEventObject() );

   // Start with a clean background
   //
   // Under GTK, we specifically set the toolbar background to the background
   // colour in the system theme.
#if defined( __WXGTK__ )
   dc.SetBackground( wxBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND ) ) );
#endif

   dc.Clear();

// EXPERIMENTAL_THEMING is set to not apply the gradient
// on wxMAC builds.  on wxMAC we have the AQUA_THEME.
#ifdef USE_AQUA_THEME
   Repaint( &dc );
#else

#ifdef EXPERIMENTAL_THEMING
   wxImage * mpBackGradient =   &theTheme.Image( bmpRecoloredUpLarge  );

   if( mpBackGradient != NULL )
   {
      wxSize imSz( mpBackGradient->GetWidth(), mpBackGradient->GetHeight() );
      wxSize sz = GetSize();
      int y;
      for(y=0;y<sz.y;y++)
      {
         int yPix = ((float)y * imSz.y - 1.0f)/(sz.y-1);
         wxColour col(
            mpBackGradient->GetRed( 0, yPix),
            mpBackGradient->GetGreen( 0, yPix),
            mpBackGradient->GetBlue( 0, yPix));

         // Set background colour so that controls placed on this
         // toolbar such as radio buttons will draw reasonably.
         // It's a little tacky setting the background colour
         // here, but we can't do it in the constructor as the gradient
         // may not be available yet.
         // Better than this would be to set the colour when the image
         // is loaded.
         // We use the colour at the half way point as a suitable 'average'.
         if( y==(sz.y/2) )
         {
            SetBackgroundColour( col );
         }
         wxPen Pen( col );
         dc.SetPen(Pen );
         AColor::Line(dc, 0, y, sz.x, y );
      }
   }
#endif
#endif
}
开发者ID:jengelh,项目名称:audacity,代码行数:59,代码来源:ToolBar.cpp


示例6: notestKeyhole

 /**
  * Test a keyhole.
  */
 void notestKeyhole()
   {
   TS_TRACE("Canvas DrawKeyhole");
   int argc = 0;
   QApplication app(argc, (char **)nullptr, 0);
   Canvas c;
   Pen(Pen::SOLID, 1, Color(0, 0, 0));
   Brush(Color(128, 128, 0));
   c.DrawKeyhole(0, 0, 10, 20, Angle::Degrees(-10), Angle::Degrees(10));
   c.show();
   app.exec();
   }
开发者ID:Exadios,项目名称:YCSoar,代码行数:15,代码来源:Suite.test.hpp


示例7: DrawLine

void DrawLine(POINT OrgPt,POINT EndPt,CDC* pDC,COLORREF ColorRef,
              double Zoom)
{

   int W = (int)Zoom;
   if (W < 1) W = 1;

   CPen  Pen(PS_SOLID,W,ColorRef);
   CPen* pOldPen = (CPen*)pDC->SelectObject(&Pen);

   DrawLine(OrgPt,EndPt,pDC);

   pDC->SelectObject(pOldPen);

}
开发者ID:Mariademo,项目名称:alsigm,代码行数:15,代码来源:GEOM.CPP


示例8: ResetRegion

void DrawItemShape::OnPaint( Graphics &g )
{
	if(isChangeRegion())
	{
		ResetRegion();
	}
	auto region = getRegion();
	SolidBrush brush(DrawTools::ColorNormal);
	if (m_isFillPath)
	{
		if (StateNormal == m_state)
		{
			g.FillRegion(&brush, region.get());
		}
		else if (StateHovered == m_state)
		{
			g.FillRegion(&SolidBrush(DrawTools::ColorHovered), region.get());
		}
		else if (StateDisable == m_state)
		{
			g.FillRegion(&SolidBrush(DrawTools::ColorDisable), region.get());
		}
		else if (StateDown == m_state)
		{
			g.FillRegion(&SolidBrush(DrawTools::ColorDown), region.get());
		}
		else if (StateError == m_state)
		{
			g.FillRegion(&SolidBrush(DrawTools::ColorError), region.get());
		}
		else
		{
			g.FillRegion(&SolidBrush(m_fillColor), region.get());
		}
	}
	if (m_isDrawPath)
	{
		GraphicsPath path;
		path.StartFigure();
		for(auto itter = m_lines.begin();itter != m_lines.end() ; itter++ )
		{
			(*itter)->getPath(path);
		}
		path.CloseFigure();

		g.DrawPath(&Pen(m_drawColor),&path);
	}
}
开发者ID:jzaicn,项目名称:DrawTools,代码行数:48,代码来源:DrawItem.cpp


示例9: endPoint

void CurveBrush::strokePens(QPointF pi1, QPointF pi2, KisPainter &/*painter*/)
{
    if (m_pens.isEmpty()) {
        m_pens.append(Pen(pi1, 0.0, 1.0));
    }

    qreal dx = pi2.x() - pi1.x();
    qreal dy = pi2.y() - pi1.y();
    for (int i = 0; i < m_pens.length(); i++) {
        Pen &pen = m_pens[i];

        QPointF endPoint(dx, dy);

        QPainterPath path;
        path.moveTo(0, 0);
        path.lineTo(dx, dy);

        QTransform transform;
        transform.reset();
        transform.translate(pen.pos.x(), pen.pos.y());
        transform.scale(pen.scale, pen.scale);
        transform.rotate(pen.rotation);

        path = transform.map(path);
        //m_painter->drawPainterPath(path, QPen(Qt::white, 1.0));

        endPoint = transform.map(endPoint);
        m_painter->drawThickLine(pen.pos, endPoint, 1.0, 1.0);
        pen.pos = endPoint;
    }

    qreal branchThreshold = 0.5;
    if ((m_branch * drand48() > branchThreshold) && (m_pens.length() < 1024)) {
        int index = floor(drand48() * (m_pens.length() - 1));

        m_newPen.pos = m_pens.at(index).pos;
        m_newPen.rotation = drand48() * M_PI / 32; //atan(dy/dx) + (drand48() - 0.5) * M_PI/32;
        m_newPen.scale = drand48() * m_pens.at(index).scale;
        m_pens.append(m_newPen);
        dbgKrita << m_pens.length();
        m_branch = 0;
    }
    else {
        m_branch++;
    }
}
开发者ID:ChrisJong,项目名称:krita,代码行数:46,代码来源:curve_brush.cpp


示例10: RGB

void CPaintDlg::DrawObject(int x, int y, int type)
{
	COLORREF color;
	if (type == OBJ_CHARGER)
		color = RGB(0,0,255);
	else //type == OBJ_TECH
		color = RGB(255,0,0);
	CClientDC dc(this);
	GetClientRect(&DrawArea);
	CPen Pen(PS_SOLID,2,color);
	dc.SelectObject(Pen);
	int side = DrawArea.bottom/n;
	dc.MoveTo(x*side+1,y*side+1);
	dc.LineTo(x*side+side,y*side+side);
	dc.MoveTo(x*side+1,y*side+side);
	dc.LineTo(x*side+side,y*side+1);
}
开发者ID:AlsuShaykhattarova,项目名称:AS.1205.SysProg.1,代码行数:17,代码来源:PaintDlg.cpp


示例11: style

void Text::draw(Painter* p) const
      {
      Font f = style().font(spatium());
      p->drawText(f, QPointF(), _text);
#if 0
      QAbstractTextDocumentLayout::PaintContext c;
      c.cursorPosition = -1;
      if (cursor && !(score() && score()->printing())) {
            if (cursor->hasSelection()) {
                  QAbstractTextDocumentLayout::Selection selection;
                  selection.cursor = *cursor;
                  selection.format.setBackground(c.palette.brush(QPalette::Active, QPalette::Highlight));
                  selection.format.setForeground(c.palette.brush(QPalette::Active, QPalette::HighlightedText));
                  c.selections.append(selection);
                  }
            c.cursorPosition = cursor->position();
            }
      Color color = p->pen().color();
      c.palette.setColor(QPalette::Text, color);

      _doc->documentLayout()->draw(p->painter(), c);

      // draw frame
      if (hasFrame()) {
            Color color(frameColor());
            if (!visible())
                  color = Qt::gray;
            else if (selected())
                  color = preferences.selectColor[track() == -1 ? 0 : voice()];
            p->setPen(Pen(QBrush(color), frameWidth() * DPMM));
            p->setBrush(QBrush(Qt::NoBrush));
            if (circle())
                  p->drawArc(frame, 0, 5760);
            else {
                  int r2 = frameRound() * lrint((frame.width() / frame.height()));
                  if (r2 > 99)
                        r2 = 99;
                  p->drawRoundRect(frame, frameRound(), r2);
                  }
            }
#endif
      }
开发者ID:SSMN,项目名称:MuseScore,代码行数:42,代码来源:text.cpp


示例12: WXUNUSED

void wxPendulumDlg::wxPendulumDlgPaint(wxPaintEvent& WXUNUSED(event))
{
    SetBackgroundStyle(wxBG_STYLE_CUSTOM);
    wxBufferedPaintDC dc(this);

    // Get window dimensions
    wxSize sz = GetClientSize();
	// determine the center of the canvas
    const wxPoint center(wxPoint(sz.x / 2, sz.y / 2));

    // create background color
    wxColour powderblue = wxColour(176,224,230);

    // draw powderblue background
    dc.SetPen(powderblue);
    dc.SetBrush(powderblue);
    dc.DrawRectangle(0, 0, sz.x, sz.y);

    // draw lines
	wxPen Pen(*wxBLACK_PEN);
	Pen.SetWidth(1);
    dc.SetPen(Pen);
    dc.SetBrush(*wxBLACK_BRUSH);

    double angleAccel, dt = 0.15;

    angleAccel = (-9.81 / m_uiLength) * sin(m_Angle);
    m_AngleVelocity += angleAccel * dt;
    m_Angle += m_AngleVelocity * dt;

    int anchorX = sz.x / 2, anchorY = sz.y / 4;
    int ballX = anchorX + (int)(sin(m_Angle) * m_uiLength);
    int ballY = anchorY + (int)(cos(m_Angle) * m_uiLength);
    dc.DrawLine(anchorX, anchorY, ballX, ballY);

    dc.SetBrush(*wxGREY_BRUSH);
    dc.DrawEllipse(anchorX - 3, anchorY - 4, 7, 7);

    dc.SetBrush(wxColour(255,255,0)); // yellow
    dc.DrawEllipse(ballX - 7, ballY - 7, 20, 20);
}
开发者ID:Anatolt,项目名称:RosettaCodeData,代码行数:41,代码来源:animate-a-pendulum-2.cpp


示例13: GetRValue

void CGradientStatic::DrawHorizontalGradient()
{
	double dblRstep = (GetRValue(m_crColorRT) - GetRValue(m_crColorLB)) / static_cast<double>(m_Mem.cx);
	double dblGstep = (GetGValue(m_crColorRT) - GetGValue(m_crColorLB)) / static_cast<double>(m_Mem.cx);
	double dblBstep = (GetBValue(m_crColorRT) - GetBValue(m_crColorLB)) / static_cast<double>(m_Mem.cx);
	double r = GetRValue(m_crColorLB);
	double g = GetGValue(m_crColorLB);
	double b = GetBValue(m_crColorLB);

	for(int x = 0; x < m_Mem.cx; x++)
	{
		CPen Pen(PS_SOLID, 1, RGB(r,g,b));
		CPen* pOld = m_Mem.dc.SelectObject(&Pen);
		m_Mem.dc.MoveTo(x,0);
		m_Mem.dc.LineTo(x,m_Mem.cy);
		m_Mem.dc.SelectObject(pOld);

		r += dblRstep;
		g += dblGstep;
		b += dblBstep;
	}
}
开发者ID:BackupTheBerlios,项目名称:nextemf,代码行数:22,代码来源:GradientStatic.cpp


示例14: color

void FrameView::addShape( const QVector<QPoint>& Shape )
{
  for(qint16 pointIndex(0); pointIndex < Shape.size(); pointIndex++)
  {
    Qt::GlobalColor color(getPointColorByIndex(pointIndex+1));
    QPen Pen(color);
    QList<QGraphicsItem*> pointGroupList;
    QGraphicsLineItem* line1(new QGraphicsLineItem(-POINT_SIZE, 0, POINT_SIZE, 0));
    line1->setPen(Pen);
    pointGroupList.push_back(line1);
    QGraphicsLineItem* line2(new QGraphicsLineItem(0, -POINT_SIZE, 0, POINT_SIZE));
    line2->setPen(Pen);
    pointGroupList.push_back(line2);
    QGraphicsTextItem* label(new QGraphicsTextItem(QString::number(pointIndex)));
    label->setDefaultTextColor(color);
    label->setFont(POINT_TEXT_FONT);
    label->setPos(-2*POINT_SIZE, -2.5f*POINT_SIZE);
    pointGroupList.push_back(label);

    QGraphicsItemGroup* pointGroup = Scene->createItemGroup(pointGroupList);
    pointGroup->setPos(QPointF(Shape[pointIndex]) * Scale);
  }
}
开发者ID:igrechuhin,项目名称:ComputerVision,代码行数:23,代码来源:FrameView.cpp


示例15: DrawArrow

void DrawArrow(POINT OrgPt,POINT EndPt,CDC* pDC,COLORREF ColorRef,double Zoom)
{

   //(EndPt.x)++;
   //(EndPt.y)++;

   int W = (int)Zoom;
   if (W < 1) W = 1;

   int H = (int)(10 * Zoom);
   int L = (int)( 3 * Zoom);

   CPen    Pen(PS_SOLID,W,ColorRef);
   CBrush  Brush(ColorRef);
   CPen*   pOldPen   = (CPen*)pDC->SelectObject(&Pen);
   CBrush* pOldBrush = (CBrush*)pDC->SelectObject(&Brush);

   DrawArrow(OrgPt,EndPt,H,L,pDC);

   pDC->SelectObject(pOldPen);
   pDC->SelectObject(pOldBrush);

}
开发者ID:Mariademo,项目名称:alsigm,代码行数:23,代码来源:GEOM.CPP


示例16: GetClientRect

BOOL CTreeListColumnDragWnd::DrawDragWnd( CDC* pDC )
{
  // draw drag window
  CRect rcItem;
  GetClientRect( &rcItem );

  pDC->FillSolidRect( &rcItem, m_pTreeListCtrl->m_crBkColor );

  CPen Pen( PS_SOLID, 1, m_pTreeListCtrl->m_crGrid );
  CPen* pOldPen    = pDC->SelectObject( &Pen );
  CFont* pOldFont    = pDC->SelectObject( &m_pTreeListCtrl->m_Font );
  int nOldMode = pDC->SetBkMode( TRANSPARENT );

  ASSERT( m_pTreeListCtrl->m_arSelects.GetSize() > 0 );
  CTreeListItem* pShowItem = (CTreeListItem*)m_pTreeListCtrl->m_arSelects[0];

  DrawItem( pDC, rcItem, pShowItem );

  pDC->SetBkMode( nOldMode );
  pDC->SelectObject( pOldFont );
  pDC->SelectObject( pOldPen );
    
  return TRUE;
}
开发者ID:derekqian,项目名称:GPUSim_ATTILA,代码行数:24,代码来源:TreeListColumnDragWnd.cpp


示例17: SelectWhitePen

 void SelectWhitePen() {
   pen = Pen(1, COLOR_WHITE);
 }
开发者ID:LK8000,项目名称:LK8000,代码行数:3,代码来源:Canvas.hpp


示例18: main

//------------------------------------------------------------------------------
int
main(int argc, char *argv[])
  {
  QApplication app(argc, argv);
  Canvas c;
  Pen(Pen::SOLID, 1, Color(0, 0, 0));
    {
    c.Select(Brush(Color(128, 128, 0, Color::TRANSPARENT)));
    c.DrawKeyhole(200, 100, 50, 100, Angle::Degrees(-20), Angle::Degrees(20));
    c.DrawKeyhole(400, 100, 50, 100, Angle::Degrees(70), Angle::Degrees(110));
    c.DrawKeyhole(200, 300, 50, 100, Angle::Degrees(160), Angle::Degrees(200));
    c.DrawKeyhole(400, 300, 50, 100, Angle::Degrees(-110), Angle::Degrees(-70));
    c.show();
    app.exec();
    }
    {
    c.Clear();
    c.DrawKeyhole(200, 100, 50, 100, Angle::Degrees(35), Angle::Degrees(55));
    c.DrawKeyhole(400, 100, 50, 100, Angle::Degrees(125), Angle::Degrees(145));
    c.DrawKeyhole(200, 300, 50, 100, Angle::Degrees(215), Angle::Degrees(235));
    c.DrawKeyhole(400, 300, 50, 100, Angle::Degrees(305), Angle::Degrees(325));
    c.show();
    app.exec();
    }
    {
    c.Clear();
    c.DrawFilledRectangle(0, 0, 100, 100, Color(128, 128, 128,
                                                Color::TRANSPARENT));
    c.DrawFilledRectangle(100, 100, 200, 200, Color(128, 0, 0,
                                                    Color::TRANSPARENT));
    c.DrawFilledRectangle(150, 150, 250, 250, Color(0, 128, 0,
                                                    Color::TRANSPARENT));
    c.DrawFilledRectangle(200, 200, 300, 300, Color(0, 0, 128,
                                                    Color::TRANSPARENT));
    c.DrawTransparentText(0, 0, "0");
    c.DrawTransparentText(0, 100, "100");
    c.DrawTransparentText(0, 200, "200");
    c.DrawTransparentText(0, 300, "300");
    c.DrawTransparentText(0, 400, "400");
    c.DrawTransparentText(0, 500, "500");
    c.DrawTransparentText(100, c.GetFontHeight(), "100");
    c.DrawTransparentText(200, c.GetFontHeight(), "200");
    c.DrawTransparentText(300, c.GetFontHeight(), "300");
    c.DrawTransparentText(400, c.GetFontHeight(), "400");
    c.DrawTransparentText(500, c.GetFontHeight(), "500");
    c.show();
    app.exec();
    }
    {
    c.Clear();
    c.DrawOutlineRectangle(100, 100, 200, 200, Color(255, 0, 0));
    c.show();
    app.exec();
    }
    {
    c.Clear();
    c.DrawRoundRectangle(100, 100, 200, 200, 10, 10);
    c.DrawRoundRectangle(200, 200, 300, 300, 100, 100);
    c.DrawRoundRectangle(300, 300, 400, 400, 50, 50);
    c.show();
    app.exec();
    }
    {
    c.Clear();
    PixelRect rc;
    rc.left   = 100;
    rc.top    = 100;
    rc.right  = 200;
    rc.bottom = 200;
    c.DrawRaisedEdge(rc);
    c.show();
    app.exec();
    }
    {
    c.Clear();
    RasterPoint rp[4];
    rp[0] = {100, 100};
    rp[1] = {200, 200};
    rp[2] = {200, 300};
    rp[3] = {300, 400};
    c.DrawPolyline(rp, 4);
    c.show();
    app.exec();
    }
    {
    c.Clear();
    RasterPoint rp[6];
    rp[0] = {100, 100};
    rp[1] = {150,  50};
    rp[2] = {200, 100};
    rp[3] = {200, 200};
    rp[4] = {150, 200};
    rp[5] = {100, 100};
    c.DrawPolygon(rp, 6);
    c.show();
    app.exec();
    }
    {
    c.Clear();
//.........这里部分代码省略.........
开发者ID:Exadios,项目名称:YCSoar,代码行数:101,代码来源:ExperimentalScreen.cpp


示例19: Pen

void CGWorldOpenGL::DrawGDILineSegments(CDC * dc,CViewMatrix * pViewMatrix, CRect rViewPort,float fLeft, float fRight,float fTop,float fBottom,int iLineSize,BOOL bShowClosureErrors)
{
    CPosMatrix fromPos;
    CPosMatrix transformedFromPos;
    CPosMatrix toPos;
    CPosMatrix transformedToPos;
    int iCount=m_WireframeLineArray.GetSize();
    for (int i=0; i<iCount; i++)
    {
        const CGWorldOpenGLLine& Line=m_WireframeLineArray.GetAt(i);
        fromPos.Set(Line.pt1[0],Line.pt1[1],Line.pt1[2]);
        fromPos.Multiply(&transformedFromPos,*pViewMatrix);
        toPos.Set(Line.pt2[0],Line.pt2[1],Line.pt2[2]);
        toPos.Multiply(&transformedToPos,*pViewMatrix);

        //Reverse black and white when printing
        COLORREF crColor=Line.crColor;
        if (dc->IsPrinting() && crColor==RGB(255,255,255))
        {
            crColor=RGB(0,0,0);
        }
        toPos.Normalize();
        fromPos.Normalize();
        CRect rect;
        transformedFromPos.Normalize();
        float fFromLeft=((transformedFromPos.GetX()-fLeft)/(fRight-fLeft))*((float)rViewPort.Width())+(float)rViewPort.left;
        float fFromTop=(float)rViewPort.bottom-((transformedFromPos.GetY()-fTop)/(fBottom-fTop))*((float)rViewPort.Height());
        float fToLeft=((transformedToPos.GetX()-fLeft)/(fRight-fLeft))*((float)rViewPort.Width())+(float)rViewPort.left;
        float fToTop=(float)rViewPort.bottom-((transformedToPos.GetY()-fTop)/(fBottom-fTop))*((float)rViewPort.Height());
        CPen Pen(PS_SOLID,iLineSize,crColor);
        CPen * pPenOld=dc->SelectObject(&Pen);
        dc->MoveTo((int)fFromLeft,(int)fFromTop);
        dc->LineTo((int)fToLeft,(int)fToTop);
        dc->SelectObject(pPenOld);
    }

    iCount=m_LineArray.GetSize();
    for (i=0; i<iCount; i++)
    {
        const CGWorldOpenGLLine& Line=m_LineArray.GetAt(i);
        //crColor==CLOSURE_RGB indicates loop closure.
        BOOL bShowThisLine=TRUE;
        if (Line.crColor==CLOSURE_RGB)
        {
            bShowThisLine=bShowClosureErrors;
        }

        if (bShowThisLine)
        {
            fromPos.Set(Line.pt1[0],Line.pt1[1],Line.pt1[2]);
            fromPos.Multiply(&transformedFromPos,*pViewMatrix);
            toPos.Set(Line.pt2[0],Line.pt2[1],Line.pt2[2]);
            toPos.Multiply(&transformedToPos,*pViewMatrix);
            //Reverse black and white when printing
            COLORREF crColor=Line.crColor;
            if (dc->IsPrinting() && crColor==RGB(255,255,255))
            {
                crColor=RGB(0,0,0);
            }
            toPos.Normalize();
            fromPos.Normalize();
            CRect rect;
            transformedFromPos.Normalize();
            float fFromLeft=((transformedFromPos.GetX()-fLeft)/(fRight-fLeft))*((float)rViewPort.Width())+(float)rViewPort.left;
            float fFromTop=(float)rViewPort.bottom-((transformedFromPos.GetY()-fTop)/(fBottom-fTop))*((float)rViewPort.Height());
            float fToLeft=((transformedToPos.GetX()-fLeft)/(fRight-fLeft))*((float)rViewPort.Width())+(float)rViewPort.left;
            float fToTop=(float)rViewPort.bottom-((transformedToPos.GetY()-fTop)/(fBottom-fTop))*((float)rViewPort.Height());

            CPen Pen(crColor==CLOSURE_RGB?PS_DASH:PS_SOLID,iLineSize,crColor==CLOSURE_RGB?RGB(255,0,0):crColor);
            CPen * pPenOld=dc->SelectObject(&Pen);
            dc->MoveTo((int)fFromLeft,(int)fFromTop);
            dc->LineTo((int)fToLeft,(int)fToTop);
            dc->SelectObject(pPenOld);
        }
    }
    int iTriangleGroupCount=m_TriangleGroupArray.GetSize();
    for (i=0; i<iTriangleGroupCount; i++)
    {
        CGWorldTriangleGroup const * pGroup=m_TriangleGroupArray.GetAt(i);
        pGroup->DumpToGL();
    }
    glEndList();

}
开发者ID:robhughadams,项目名称:onstation,代码行数:84,代码来源:gworldopengl.cpp


示例20: mGraphics

void CPenBrushUnit::DrawMultiPenBrush(CDC *memDC,CPoint ePoint,std::vector<temSavePoint> &MultipsPoint,MultiInfo &GetMultiInfo,DWORD mouseid)
{
	int Red,Green,Blue;
	Red=GetRValue(GetMultiInfo.penColor);
	Green=GetGValue(GetMultiInfo.penColor);
	Blue=GetBValue(GetMultiInfo.penColor);
	Graphics mGraphics(memDC->m_hDC);
	mGraphics.SetSmoothingMode(SmoothingModeAntiAlias);

	SolidBrush brush(Color(255,Red,Green,Blue));
	UINT Size=MultipsPoint.size();
	CPoint sPoint=MultipsPoint[Size-1].point;
	if(Size==1)
	{
		if(fwidth.find(mouseid)!=fwidth.end())
			fwidth.erase(mouseid);
		fwidth.insert(std::map<DWORD,float>::value_type(mouseid,MultipsPoint[0].preWidth));
		PushStart(ePoint,mouseid);
	}
	if(Push(sPoint,ePoint,mouseid))
	{
		RectF headRect;
		RectF tailRect;
		float width,dx,dy;
		PointF lfCenter,rtCenter;
		mGraphics.FillPolygon(&brush,pts,npts);
		mGraphics.DrawPolygon(&Pen(Color(255,Red,Green,Blue),0.5f),pts,npts);
		if(npts==4)
		{
			headRect=RectF((pts[0].X+pts[3].X)/2.0f,(pts[0].Y+pts[3].Y)/2.0f,0.0f,0.0f);
			tailRect=RectF((pts[1].X+pts[2].X)/2.0f,(pts[1].Y+pts[2].Y)/2.0f,0.0f,0.0f);
			dx=pts[3].X-pts[0].X;
			dy=pts[3].Y-pts[0].Y;
			width=sqrt(dx*dx+dy*dy)/2.0f+0.5f;
			headRect.Inflate(width,width);
			dx=pts[2].X-pts[1].X;
			dy=pts[2].Y-pts[1].Y;
			width=sqrt(dx*dx+dy*dy)/2.0f+0.5f;
			tailRect.Inflate(width,width);
		}
		else
		{
			headRect=RectF((pts[0].X+pts[9].X)/2.0f,(pts[0].Y+pts[9].Y)/2.0f,0.0f,0.0f);
			tailRect=RectF((pts[4].X+pts[5].X)/2.0f,(pts[4].Y+pts[5].Y)/2.0f,0.0f,0.0f);
			dx=pts[9].X-pts[0].X;
			dy=pts[9].Y-pts[0].Y;
			width=sqrt(dx*dx+dy*dy)/2.0f+0.5f;
			headRect.Inflate(width,width);
			dx=pts[5].X-pts[4].X;
			dy=pts[5].Y-pts[4].Y;
			width=sqrt(dx*dx+dy*dy)/2.0f+0.5f;
			tailRect.Inflate(width,width);
		}
		brush.SetColor(Color(255,Red,Green,Blue));
		mGraphics.FillEllipse(&brush,headRect);
		mGraphics.FillEllipse(&brush,tailRect);

		temSavePoint addPoint;
		addPoint.point=ePoint;
		addPoint.alpha=MultipsPoint[Size-1].alpha;
		addPoint.preWidth=MultipsPoint[Size-1].preWidth;
		MultipsPoint.push_back(addPoint);
	}
}
开发者ID:duiniuluantanqin,项目名称:SCT_Board,代码行数:64,代码来源:PenBrushUnit.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ Permit函数代码示例发布时间:2022-05-30
下一篇:
C++ PeiServicesLocatePpi函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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