本文整理汇总了C++中drawLines函数的典型用法代码示例。如果您正苦于以下问题:C++ drawLines函数的具体用法?C++ drawLines怎么用?C++ drawLines使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drawLines函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: whiteBeam
void BurstShot::draw(QPainter *painter)
{
painter->save();
QColor whiteBeam(0,255,255,255);
QColor blackBeam(255,0,0,255);
QColor *currentColor = polarity == WHITE? &whiteBeam: &blackBeam;
currentColor->setAlphaF(0.25f);
QPen pen(*currentColor, 15, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
painter->setPen(pen);
drawLines(painter, 15);
currentColor->setAlphaF(0.5f);
pen.setColor(*currentColor);
pen.setWidth(4);
painter->setPen(pen);
drawLines(painter, 10);
pen.setColor(polarity == WHITE? Qt::white : Qt::black);
pen.setWidth(2);
painter->setPen(pen);
drawLines(painter, 5);
//debug
// pen.setColor(Qt::green);
// painter->setPen(pen);
// painter->drawRect(hitBox);
painter->restore();
}
示例2: drawRect
void drawRect(int minx, int miny, int maxx, int maxy)
{
drawLines(minx, miny, maxx, miny);
drawLines(maxx, miny, maxx, maxy);
drawLines(minx, maxy, maxx, maxy);
drawLines(minx, miny, minx, maxy);
}
示例3: switch
void QwtCurve::drawCurve(QPainter *painter, int style,
const QwtDiMap &xMap, const QwtDiMap &yMap, int from, int to)
{
switch (style)
{
case NoCurve:
break;
case Lines:
drawLines(painter, xMap, yMap, from, to);
break;
case Sticks:
drawSticks(painter, xMap, yMap, from, to);
break;
case Steps:
drawSteps(painter, xMap, yMap, from, to);
break;
case Spline:
if ( from > 0 || to < dataSize() - 1 )
drawLines(painter, xMap, yMap, from, to);
else
drawSpline(painter, xMap, yMap);
break;
case Dots:
drawDots(painter, xMap, yMap, from, to);
break;
default:
break;
}
}
示例4: redraw
void redraw(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if(hexflag)
draw_hexcube();
glColor3f(1.0, 0.0, 0.0);
drawLines(rp, rv);
sphdraw(rv[rp]);
glColor3f(0.0, 0.0, 1.0);
drawLines(bp, bv);
sphdraw(bv[bp]);
glColor3f(0.0, 1.0, 0.0);
drawLines(gp, gv);
sphdraw(gv[gp]);
glColor3f(1.0, 0.0, 1.0);
drawLines(yp, yv);
sphdraw(yv[yp]);
glColor3f(0.0, 1.0, 1.0);
drawLines(mp, mv);
sphdraw(mv[mp]);
glutSwapBuffers();
}
示例5: computeTscale
void
ClipObject::draw(QGLViewer *viewer,
bool backToFront, float widgetSize)
{
m_size = widgetSize;
computeTscale();
if (!m_show)
return;
if (m_imagePresent ||
m_captionPresent ||
(m_gridX > 0 && m_gridY > 0) )
{
if (m_gridX > 0 && m_gridY > 0)
drawGrid();
if (m_imagePresent || m_captionPresent)
drawCaptionImage();
if (m_active) drawLines(viewer, backToFront);
}
else
drawLines(viewer, backToFront);
}
示例6: display
// 点列からBezier曲線を太く描く
void display(void)
{
float c[2000][2]; // 曲線上の点列を格納する配列
int i,j, j2, k;
glClear(GL_COLOR_BUFFER_BIT); // 画面消去
drawPoints( pt,np );
drawLines( pt,np );
// 以下の5行を消去して、Bezier曲線上の点列を生成して配列 c[][2]に格納すること
if( np < 3 ){ glFlush(); return; }
//for( i=0,j=0; i<np-1; i++,j++ ){
// c[j][0] = (pt[i][0] + pt[i+1][0])/2.; // x 座標値
// c[j][1] = (pt[i][1] + pt[i+1][1])/2.; // y 座標値
//}
for(i=0,j=0; i<np-3; i+=3) {
for(j2=0; j2<=precision; j++,j2++) {
double t = (double)j2/precision;
for( k=0; k<2; k++) {
c[j][k] = ((pow(1-t,3) * pt[i][k]) + ((3*pow(t,3) - 6*t*t + 4) * pt[i+1][k])
+ ((-3*pow(t,3) + 3*t*t + 3*t + 1) * pt[i+2][k]) + (pow(t,3) * pt[i+3][k])) / 6;
}
}
}
glLineWidth(3.); // 線の太さを3pixels にする
drawLines( c,j );// 配列cの中のj個の点を結んで折れ線を描く
glLineWidth(1.); // 線の太さを1に戻す
glFlush(); // 画面に出力
}
示例7: drawLines
static void drawLines(Node p, int x, int y) {
if (p->kids[0]) {
drawLines(p->kids[0], x + p->x.centre, y + Y_SCALE);
drawLine(x + p->x.centre, y, x + p->x.centre + p->kids[0]->x.centre, y + Y_SCALE);
}
if (p->kids[1]) {
drawLines(p->kids[1], x + p->x.centre, y + Y_SCALE);
drawLine(x + p->x.centre, y, x + p->x.centre + p->kids[1]->x.centre, y + Y_SCALE);
}
}
示例8: setAlpha
void MoonWalker::render(VoodooGraphics graphics, int elapsed)
{
graphics.painter()->save();
// если нужно создать наклон для машинки
if(position()->x() >= 0 && position()->x() <= 30)
{
setAlpha(1);
} else if (position()->x() >= 30 && position()->x() <= 50)
{
setAlpha(2);
} else if (position()->x() >= 100 && position()->x() <= 300)
{
setAlpha(-1);
} else if (position()->x() >= 300 && position()->x() <= 510)
{
setAlpha(1);
} else if (position()->x() >= 510 && position()->x() <= 800)
{
setAlpha(-4);
}
// тело машины
drawLines(graphics, lines1);
// кабинка
drawLines(graphics, lines2);
// антенна
drawLines(graphics, lines3);
QPoint point;
qint32 radius = 1 * scale();
for(int i = 0; i < 4; i++)
{
point = graphics.rotate(10 * scale() - i * radius * 2, 7 * scale(), alpha());
graphics.drawCircle(point.x() + position()->x(), point.y() + position()->y(), radius);
graphics.drawCircle(point.x() + position()->x(), point.y() + position()->y(), elapsed / 160);
}
// антенна
point = graphics.rotate(12 * scale(), 0, alpha());
graphics.drawCircle(position()->x() + point.x(), position()->y() + point.y(), 1 * scale());
graphics.drawCircle(position()->x() + point.x(), position()->y() + point.y(), 5);
graphics.drawCircle(position()->x() + point.x(), position()->y() + point.y(), elapsed / 20);
if (position()->x() >= width() + 10)
{
setPosition(0, position()->y());
setIterator(0);
}
setPosition(iterator() + 1, position()->y());
setIterator(iterator() + 1);
graphics.painter()->restore();
}
示例9: part
/*!
\brief Draw the line part (without symbols) of a curve interval.
\param painter Painter
\param style curve style, see QwtPlotCurve::CurveStyle
\param xMap x map
\param yMap y map
\param canvasRect Contents rectangle of the canvas
\param from index of the first point to be painted
\param to index of the last point to be painted
\sa draw(), drawDots(), drawLines(), drawSteps(), drawSticks()
*/
void QwtPlotCurve::drawCurve( QPainter *painter, int style,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRectF &canvasRect, int from, int to ) const
{
switch ( style )
{
case Lines:
if ( testCurveAttribute( Fitted ) )
{
// we always need the complete
// curve for fitting
from = 0;
to = dataSize() - 1;
}
drawLines( painter, xMap, yMap, canvasRect, from, to );
break;
case Sticks:
drawSticks( painter, xMap, yMap, canvasRect, from, to );
break;
case Steps:
drawSteps( painter, xMap, yMap, canvasRect, from, to );
break;
case Dots:
drawDots( painter, xMap, yMap, canvasRect, from, to );
break;
case LinesAndDots:
{
if ( testCurveAttribute( Fitted ) )
{
from = 0;
to = dataSize() - 1;
}
drawLines( painter, xMap, yMap, canvasRect, from, to );
QPen prev_pen = painter->pen();
QPen new_pen = prev_pen;
new_pen.setWidth( prev_pen.width() * 3);
painter->setPen( new_pen );
drawDots( painter, xMap, yMap, canvasRect, from, to );
painter->setPen( prev_pen );
}
break;
case NoCurve:
default:
break;
}
}
示例10: main
int main(int argc, char *argv[])
{
char *iim, *idb, * oim;
ObjectDB newobjs, known;
Image im;
if (argc != 4) {
fprintf(stderr, "usage: %s <input labeled image> <input database> <output image>", argv[0]);
}
iim=argv[1];
idb=argv[2];
oim=argv[3];
readImage(&im, iim);
readDatabase(&known, idb); /* get the database of known objects */
makeODB(&newobjs, getColors(&im)); /* create the database for the input image */
getObjects(&im, &newobjs); /* fill the database for the input image */
filterObjects(&im, &newobjs, &known); /* find known objects in the database and throw away those unknown */
drawLines(&im, &newobjs); /* draw lines in the input image */
writeImage(&im, oim); /* write the output image */
free(newobjs.objs);
free(known.objs);
free(im.data);
return 0;
}
示例11: drawOutline
/*!
Draw a subset of the histogram samples
\param painter Painter
\param xMap Maps x-values into pixel coordinates.
\param yMap Maps y-values into pixel coordinates.
\param canvasRect Contents rect of the canvas
\param from Index of the first sample to be painted
\param to Index of the last sample to be painted. If to < 0 the
series will be painted to its last sample.
\sa drawOutline(), drawLines(), drawColumns
*/
void QwtPlotHistogram::drawSeries( QPainter *painter,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRectF &, int from, int to ) const
{
if ( !painter || dataSize() <= 0 )
return;
if ( to < 0 )
to = dataSize() - 1;
switch ( d_data->style )
{
case Outline:
drawOutline( painter, xMap, yMap, from, to );
break;
case Lines:
drawLines( painter, xMap, yMap, from, to );
break;
case Columns:
drawColumns( painter, xMap, yMap, from, to );
break;
default:
break;
}
}
示例12: drawLines
void CanvasWidget::drawLine(const video::Color& color, float width, bool smoothLine, const Vector2& from, const Vector2& to)
{
Vector2 vertices[2];
vertices[0] = from;
vertices[1] = to;
drawLines(color, width, smoothLine, vertices, 2);
}
示例13: i
void QGLView::drawDrawables(QGLView::ModelType type)
{
if (type == NoType)
{
QMapIterator<ModelType, QList<Parameters*>* > i(m_drawableMap);
while (i.hasNext()) {
i.next();
drawDrawables(i.key());
}
}
else
{
switch (type)
{
case Cube:
case Cylinder:
case Cone:
case Sphere:
drawModelVertices(type);
break;
case Text:
drawTexts();
break;
case Line:
drawLines();
break;
default:
return;
}
}
}
示例14: part
/*!
\brief Draw the line part (without symbols) of a curve interval.
\param painter Painter
\param style curve style, see QwtPlotCurve::CurveStyle
\param xMap x map
\param yMap y map
\param canvasRect Contents rectangle of the canvas
\param from index of the first point to be painted
\param to index of the last point to be painted
\sa draw(), drawDots(), drawLines(), drawSteps(), drawSticks()
*/
void QwtPlotCurve::drawCurve( QPainter *painter, int style,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRectF &canvasRect, int from, int to ) const
{
switch ( style )
{
case Lines:
if ( testCurveAttribute( Fitted ) )
{
// we always need the complete
// curve for fitting
from = 0;
to = dataSize() - 1;
}
drawLines( painter, xMap, yMap, canvasRect, from, to );
break;
case Sticks:
drawSticks( painter, xMap, yMap, canvasRect, from, to );
break;
case Steps:
drawSteps( painter, xMap, yMap, canvasRect, from, to );
break;
case Dots:
drawDots( painter, xMap, yMap, canvasRect, from, to );
break;
case NoCurve:
default:
break;
}
}
示例15: renderDemo
void renderDemo(struct NVGcontext* vg, float mx, float my, float width, float height,
float t, int blowup, struct DemoData* data)
{
float x,y,popy;
drawEyes(vg, width - 250, 50, 150, 100, mx, my, t);
drawParagraph(vg, width - 450, 50, 150, 100, mx, my);
drawGraph(vg, 0, height/2, width, height/2, t);
drawColorwheel(vg, width - 300, height - 300, 250.0f, 250.0f, t);
// Line joints
drawLines(vg, 50, height-50, 600, 50, t);
// Line caps
drawWidths(vg, 10, 50, 30);
// Line caps
drawCaps(vg, 10, 300, 30);
nvgSave(vg);
if (blowup) {
nvgRotate(vg, sinf(t*0.3f)*5.0f/180.0f*NVG_PI);
nvgScale(vg, 2.0f, 2.0f);
}
// Widgets
drawWindow(vg, "Widgets `n Stuff", 50, 50, 300, 400);
x = 60; y = 95;
drawSearchBox(vg, "Search", x,y,280,25);
y += 40;
drawDropDown(vg, "Effects", x,y,280,28);
popy = y + 14;
y += 45;
// Form
drawLabel(vg, "Login", x,y, 280,20);
y += 25;
drawEditBox(vg, "Email", x,y, 280,28);
y += 35;
drawEditBox(vg, "Password", x,y, 280,28);
y += 38;
drawCheckBox(vg, "Remember me", x,y, 140,28);
drawButton(vg, ICON_LOGIN, "Sign in", x+138, y, 140, 28, nvgRGBA(0,96,128,255));
y += 45;
// Slider
drawLabel(vg, "Diameter", x,y, 280,20);
y += 25;
drawEditBoxNum(vg, "123.00", "px", x+180,y, 100,28);
drawSlider(vg, 0.4f, x,y, 170,28);
y += 55;
drawButton(vg, ICON_TRASH, "Delete", x, y, 160, 28, nvgRGBA(128,16,8,255));
drawButton(vg, 0, "Cancel", x+170, y, 110, 28, nvgRGBA(0,0,0,0));
// Thumbnails box
drawThumbnails(vg, 365, popy-30, 160, 300, data->images, 12, t);
nvgRestore(vg);
}