コード例 #1
0
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
0
ファイル: forShihao.cpp プロジェクト: jerry1010/forshihao
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
0
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
0
ファイル: lorenz.c プロジェクト: amlanpradhan/GLUT
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
0
ファイル: clipobject.cpp プロジェクト: Elavina6/drishti
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
0
ファイル: bspline.c プロジェクト: gam0022/computer-graphics
// 点列から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
0
ファイル: svg.c プロジェクト: Melab/gvmt
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
0
ファイル: moonwalker.cpp プロジェクト: oivoodoo/MoonWalker
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
0
/*!
  \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
0
ファイル: p4.c プロジェクト: haywood/Vision1
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
0
ファイル: qwt_plot_histogram.cpp プロジェクト: Aconex/pcp
/*!
  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
0
ファイル: canvaswidget.cpp プロジェクト: mcdooda/flat-engine
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
0
ファイル: qglview.cpp プロジェクト: hekav/QtQuickVcp
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
0
/*!
  \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
0
ファイル: demo.c プロジェクト: jacereda/nanovg
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);
}
コード例 #16
0
/*!
  Draw the marker

  \param painter Painter
  \param xMap x Scale Map
  \param yMap y Scale Map
  \param canvasRect Contents rectangle of the canvas in painter coordinates
*/
void QwtPlotMarker::draw( QPainter *painter,
    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    const QRectF &canvasRect ) const
{
    const QPointF pos( xMap.transform( d_data->xValue ), 
        yMap.transform( d_data->yValue ) );

    // draw lines

    drawLines( painter, canvasRect, pos );

    // draw symbol
    if ( d_data->symbol &&
        ( d_data->symbol->style() != QwtSymbol::NoSymbol ) )
    {
        const QSizeF sz = d_data->symbol->size();

        const QRectF clipRect = canvasRect.adjusted( 
            -sz.width(), -sz.height(), sz.width(), sz.height() );

        if ( clipRect.contains( pos ) )
            d_data->symbol->drawSymbol( painter, pos );
    }

    drawLabel( painter, canvasRect, pos );
}
コード例 #17
0
/*!

 */
void
FieldPainter::draw( QPainter & painter )
{
    if ( Options::instance().minimumMode() )
    {
        painter.fillRect( painter.window(),
                          Qt::black );
        return;
    }

    if ( Options::instance().antiAliasing() )
    {
        painter.setRenderHint( QPainter::Antialiasing, false );
    }

    drawBackGround( painter );
    drawLines( painter );
    drawPenaltyAreaLines( painter );
    drawGoalAreaLines( painter );
    drawGoals( painter );
    if ( Options::instance().showFlag() )
    {
        drawFlags( painter );
    }
    if ( Options::instance().gridStep() > 0.0 )
    {
        drawGrid( painter );
    }

    if ( Options::instance().antiAliasing() )
    {
        painter.setRenderHint( QPainter::Antialiasing );
    }
}
コード例 #18
0
void GLWidget::paintGL()
{

    glClearColor(1.0, 1.0, 0.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    switch (type)
    {
        case 0:  drawPoints() ;
                 break;
        case 1:  drawLines();
                 break;
        case 2:  drawLineStrip();
                 break;
        case 3:  drawLineLoop();
                 break;
        case 4:  drawTriangles();
                 break;
        case 5:  drawTriangleStrip();
                 break;
        case 6:  drawTriangleFan();
                 break;
        case 7:  drawQuads();
                 break;
        case 8:  drawQuadStrip();
                 break;
        case 9:  drawPolygons();
                 break;
        default: break;
    }


}
コード例 #19
0
void MicroRace::drawBackground()
{
	spriteBatch->draw(back, glm::translate(glm::mat4(), glm::vec3(backPosition - 1920, 0, 0)));
	spriteBatch->draw(back, glm::translate(glm::mat4(), glm::vec3(backPosition, 0, 0)));
	spriteBatch->draw(back, glm::translate(glm::mat4(), glm::vec3(backPosition + 1920, 0, 0)));
	drawLines();
}
コード例 #20
0
/*!
    \overload

    The default implementation converts the first \a lineCount lines
    in \a lines to a QLineF and calls the floating point version of
    this function.
*/
void QPaintEngine::drawLines(const QLine *lines, int lineCount)
{
    struct PointF {
        qreal x;
        qreal y;
    };
    struct LineF {
        PointF p1;
        PointF p2;
    };
    Q_ASSERT(sizeof(PointF) == sizeof(QPointF));
    Q_ASSERT(sizeof(LineF) == sizeof(QLineF));
    LineF fl[256];
    while (lineCount) {
        int i = 0;
        while (i < lineCount && i < 256) {
            fl[i].p1.x = lines[i].x1();
            fl[i].p1.y = lines[i].y1();
            fl[i].p2.x = lines[i].x2();
            fl[i].p2.y = lines[i].y2();
            ++i;
        }
        drawLines((QLineF *)(void *)fl, i);
        lines += i;
        lineCount -= i;
    }
}
コード例 #21
0
ファイル: p3.c プロジェクト: haywood/Vision1
int main(int argc, char *argv[])
{
	char *ifname, *odname, *ofname;
	ObjectDB odb;
	Image im;

	if (argc < 4) {
		fprintf(stderr, "usage: %s <input labeled image> <output database> <output image>", argv[0]);
		return 1;
	}

	ifname=argv[1];
	odname=argv[2];
	ofname=argv[3];

	readImage(&im, ifname);
	makeODB(&odb, getColors(&im));
	getObjects(&im, &odb);
	writeDatabase(&odb, odname);
	drawLines(&im, &odb);
	writeImage(&im, ofname);

	free(odb.objs);
	free(im.data);

	return 0;
}
コード例 #22
0
ファイル: linechart.cpp プロジェクト: kaibader/CaSSiS
// method is called each time our chart needs to be repainted
void LineChart::paintEvent(QPaintEvent *) {
    // Repaint is only done if values has changed
    if (m_needs_repaint) {
        if (m_image != NULL)
            delete m_image;

        m_image = new QImage(size(), QImage::Format_ARGB32);

        QPainter image_painter(m_image); // create new empty (white) painter
        image_painter.begin(m_image);
        image_painter.fillRect(m_image->rect(), Qt::white);

        QFont smallFont("Helvetica", 8);
        image_painter.setFont(smallFont); // standard font settings

        // draw lines if data is available
        if (m_has_data) {
            drawChart(image_painter);
            drawLines(image_painter);
        }

        m_needs_repaint = false; // nearly all work done... ;-)
    }

    QPainter this_painter(this);
    this_painter.drawImage(QPoint(0, 0), *m_image);

    if (m_mouse_pressed) {
        QPen coord_pen(Qt::yellow, 1); // yellow, 1 pixel wide
        this_painter.setPen(coord_pen);
        this_painter.drawRect(m_mouse_x_min, m_mouse_y_min,
                (m_mouse_x_act - m_mouse_x_min),
                (m_mouse_y_act - m_mouse_y_min));
    }
}
コード例 #23
0
ファイル: FaceTracer.cpp プロジェクト: digitaltembo/jade
Mat& FaceTracker::draw(Mat& img){
    if(failed)
        return img;
    drawTriangles(img);
    drawLines(img);
    drawPoints(img);
    return img;
}
コード例 #24
0
ファイル: FaceTracer.cpp プロジェクト: digitaltembo/jade
Mat& FaceTracker::draw(){
    if(grayImg.empty()||failed)
        return grayImg;
    drawTriangles(grayImg);
    drawLines(grayImg);
    drawPoints(grayImg);
    return grayImg;
}
コード例 #25
0
ファイル: grid.cpp プロジェクト: vt4a2h/ocean-game
    void Grid::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
    {
        Q_UNUSED(option)
        Q_UNUSED(widget)

        drawBorder(painter);
        if (m_DrowLines) drawLines(painter);
    }
コード例 #26
0
void QCairoPaintEngine::drawLines(const QLine *lines, int lineCount)
{
    QVector<QLineF> l;
    for (int i=0; i<lineCount; i++) {
        l.append(QLineF(lines[i]));
    }
    drawLines(l.data(), l.size());
}
コード例 #27
0
ファイル: main.cpp プロジェクト: iKrishneel/cuda-tutorials
int main(int argc, char *argv[]) {

    // std::string file = std::string(argv[1]);
    // cv::Mat img = cv::imread(file);
    cv::VideoCapture cap(0);
    if (!cap.isOpened()) {
        return -1;
    }
    
    for (; ; ) {
        cv::Mat img;
        cap >> img;

        if (img.empty()) {
            return -1;
        }
        cv::resize(img, img, cv::Size(640, 480));
        cv::cvtColor(img, img, CV_BGR2GRAY);
        cv::Mat outimg, outimg2;

        cv::cuda::GpuMat d_src, d_dst;
        d_src.upload(img);
        cv::Ptr<cv::cuda::CannyEdgeDetector> canny =
            cv::cuda::createCannyEdgeDetector(50.0, 100.0);
        canny->detect(d_src, d_dst);
        d_dst.download(outimg);
        
        cv::cuda::GpuMat hline_src, hline_dst;
        hline_src.upload(outimg);
        cv::Ptr<cv::cuda::HoughLinesDetector> hough =
            cv::cuda::createHoughLinesDetector(1.0f, 1.5 * M_PI/180.0f, 100);
        hough->detect(hline_src, hline_dst);
        // hline_dst.download(hough_lines);
        std::vector<cv::Vec2f> lines;
        hough->downloadResults(hline_dst, lines);

        std::cout << "NUMBER OF LINES: " << lines.size()  << "\n";
        
        cv::Mat hough_lines = cv::Mat::zeros(img.size(), CV_8UC1);
        drawLines(hough_lines, lines);
        
        cv::imshow("image", img);
        cv::imshow("canny", outimg);
        cv::imshow("lines", hough_lines);
        
        if (cv::waitKey(30) >= 0) {
            cap.release();
            break;
        }
    }

    // print device info
    cv::cuda::DeviceInfo info;
    std::cout << "THREADS:" << info.maxThreadsPerBlock()  << "\n";
    
    return 0;
}
コード例 #28
0
ファイル: TEDITOR1.cpp プロジェクト: hackshields/antivirus
void TEditor::draw()
{
    if( drawLine != delta.y )
        {
        drawPtr = lineMove( drawPtr, delta.y - drawLine );
        drawLine = delta.y;
        }
    drawLines( 0, size.y, drawPtr );
}
コード例 #29
0
ファイル: rectangle.cpp プロジェクト: Mgk2000/LadderRunner
void ARectangle::drawFramed(float x1, float y1, float x2, float y2, float lwidth,
                            const Point4D& color, const Point4D &framecolor)
{
    setParams(x1, y1, x2, y2, color);
    drawTriangles (vboIds[1]);
    _scaleX = _scaleX * (x2-x1) / (x2-x1 + lwidth/view->width);
    _scaleY= _scaleY * (y2-y1) / (y2-y1 + lwidth/view->height);
    drawLines(GL_LINE_LOOP,vboIds[2], nvertices, framecolor , lwidth);
}
コード例 #30
0
void drawRoadBetween(int n, int n2){
	City c1 = findCity(n);
	City c2 = findCity(n2);

	int * colors1 = getColor(c1->num);
	int * colors2 = getColor(c2->num);

	int xC1 = c1->x + (size + size/20)/2;
	int yC1 = c1->y + (size + size/20)/2;
	int xC2 = c2->x + (size + size/20)/2;
	int yC2 = c2->y + (size + size/20)/2;

	drawLines(xC1, yC1, xC2, yC2, *(colors1), *(colors1 + 1), *(colors1 + 2));
	drawLines(xC1+3, yC1+3, xC2+3, yC2+3, *(colors2), *(colors2 + 1), *(colors2 + 2));

	free(colors1);
	free(colors2);
}