本文整理汇总了C++中Graphics::DrawLines方法的典型用法代码示例。如果您正苦于以下问题:C++ Graphics::DrawLines方法的具体用法?C++ Graphics::DrawLines怎么用?C++ Graphics::DrawLines使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graphics
的用法示例。
在下文中一共展示了Graphics::DrawLines方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void Turret::draw(Graphics& graphics, const Vector2& parentPosition)
{
graphics.SetColor(WHITE);
Engine::Matrix3 turretRotation(rotationNormal, Engine::PerpCW(rotationNormal), parentPosition);
Engine::Vector2 drawTurretArray[] =
{
turretRotation * (Engine::Vector2(0, -turretSize)),
turretRotation * (Engine::Vector2(0, turretSize)),
turretRotation * (Engine::Vector2(0, turretSize)),
turretRotation * (Engine::Vector2(turretSize, 0)),
turretRotation * (Engine::Vector2(turretSize, 0)),
turretRotation * (Engine::Vector2(0, -turretSize))
};
unsigned int drawTurretArraySize = sizeof(drawTurretArray) / (sizeof(*drawTurretArray) * 2);
graphics.SetColor(RED);
graphics.DrawLines(drawTurretArraySize, *drawTurretArray);
}
示例2: DrawImage
bool CGdiPlusImage::DrawImage(CDC* pDC, CRect& rcDraw, CRect& rcCanvas)
{
//´´½¨ÆÁÄ»
ASSERT(pDC!=NULL);
if ( !pDC ) return false;
Bitmap bmp(rcCanvas.Width(), rcCanvas.Height());
Graphics* pGraphics = Graphics::FromImage(&bmp);
if ( !pGraphics ) return false;
//GraphicsContainer Containter = pGraphics->BeginContainer();
pGraphics->SetSmoothingMode(SmoothingModeHighQuality);
SolidBrush bgbrush(Color(238, 243, 250));
pGraphics->FillRectangle(&bgbrush, 0, 0, rcCanvas.Width(), rcCanvas.Height());
if ( m_pImage )
{
//»ñÈ¡ÊôÐÔ
INT nImageWidth = m_pImage->GetWidth();
INT nImageHeight = m_pImage->GetHeight();
float fMin = 1.0F;
bool bZoomOut = false;
int nXSrc = 0;
int nYSrc = 0;
//¹¹ÔìλÖÃ
RectF rcDrawRect;
rcDrawRect.X = rcDraw.left;
rcDrawRect.Y = rcDraw.top;
rcDrawRect.Width = rcDraw.Width();
rcDrawRect.Height = rcDraw.Height();
// »±Ê
Pen pen(Color(255, 0, 0), 2);
Matrix mtr;
mtr.Translate(rcDrawRect.X + rcDrawRect.Width / 2, rcDrawRect.Y + rcDrawRect.Height / 2);
mtr.Rotate(m_nRotateAngle);
mtr.Translate(-(rcDrawRect.X + rcDrawRect.Width / 2), -(rcDrawRect.Y + rcDrawRect.Height / 2));
pGraphics->SetTransform(&mtr);
//»æ»Í¼Ïñ
pGraphics->DrawImage(
m_pImage, rcDrawRect,
nXSrc, nYSrc,
(REAL)nImageWidth - nXSrc * 2, (REAL)nImageHeight - nYSrc * 2, UnitPixel);
for ( int i = 0; i < m_vvecPoints.size(); ++ i )
{
int nCount = m_vvecPoints[i].size();
Point *pts = new Point[nCount];
for ( int j = 0; j < nCount; ++ j )
{
pts[ j ] = m_vvecPoints[ i ][ j ];
pts[ j ].X += rcDraw.left;
pts[ j ].Y += rcDraw.top;
}
//for ( int j = 0; j < nCount - 1; ++ j )
{
// pGraphics->DrawLine(&pen, pts[ j ], pts[ j +1 ]);
}
pGraphics->DrawLines(&pen, pts, nCount);
//pGraphics->DrawPolygon(&pen, pts, nCount);
delete[] pts;
pts = NULL;
}
pGraphics->ResetTransform();
//pGraphics->EndContainer(Containter);
} // if ( m_pImage )
// ´ÓÄڴ濽±´ÖÁÉ豸
Graphics graphicsreal(pDC->GetSafeHdc());
graphicsreal.DrawImage(&bmp, 0, 0, rcCanvas.Width(), rcCanvas.Height());
delete pGraphics;
pGraphics = NULL;
return true;
}