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


C++ drawLine函数代码示例

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


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

示例1: main

/*! Load a database, an image, and find best matches. */
int main(const int argc, const char **argv)
{
  MYLOGVERB = LOG_INFO;

  // check command-line args:
  if (argc < 3 || argc > 4)
    LFATAL("USAGE: app-match-SIFT-database <dbname.vdb> <image.png> "
           "[<fused.png>]");

  // load the database:
  VisualObjectDB vdb;
  if (vdb.loadFrom(argv[1]) == false)
    LFATAL("Cannot operate without a valid database.");

  // get input image:
  Image< PixRGB<byte> > colim = Raster::ReadRGB(argv[2]);

  // create visual object and extract keypoints:
  rutz::shared_ptr<VisualObject> vo(new VisualObject(argv[2], argv[2], colim));

  // get the matching objects:
  std::vector< rutz::shared_ptr<VisualObjectMatch> > matches;
  const uint nmatches = vdb.getObjectMatches(vo, matches, VOMA_KDTREEBBF);

  // prepare the fused image:
  Image< PixRGB<byte> > mimg;
  std::vector<Point2D<int> > tl, tr, br, bl;

  // if no match, forget it:
  if (nmatches == 0U)
    LINFO("### No matching object found.");
  else
    {
      // let the user know about the matches:
      for (uint i = 0; i < nmatches; i ++)
        {
          rutz::shared_ptr<VisualObjectMatch> vom = matches[i];
          rutz::shared_ptr<VisualObject> obj = vom->getVoTest();

          LINFO("### Object match with '%s' score=%f",
                obj->getName().c_str(), vom->getScore());

          // add to our fused image if desired:
          if (argc > 3)
            {
              mimg = vom->getTransfTestImage(mimg);

              // also keep track of the corners of the test image, for
              // later drawing:
              Point2D<int> ptl, ptr, pbr, pbl;
              vom->getTransfTestOutline(ptl, ptr, pbr, pbl);
              tl.push_back(ptl); tr.push_back(ptr);
              br.push_back(pbr); bl.push_back(pbl);
            }
        }

      // do a final mix between given image and matches:
      if (mimg.initialized())
        {
          mimg = Image<PixRGB<byte> >(mimg * 0.5F + colim * 0.5F);

          // finally draw all the object outlines:
          PixRGB<byte> col(255, 255, 0);
          for (uint i = 0; i < tl.size(); i ++)
            {
              drawLine(mimg, tl[i], tr[i], col, 1);
              drawLine(mimg, tr[i], br[i], col, 1);
              drawLine(mimg, br[i], bl[i], col, 1);
              drawLine(mimg, bl[i], tl[i], col, 1);
            }
        }
    }

  // save result image if desired:
  if (argc > 3)
    {
      if (mimg.initialized() == false)
        mimg = Image< PixRGB<byte> >(colim * 0.5F);
      Raster::WriteRGB(mimg, std::string(argv[3]));
    }

  return 0;
}
开发者ID:ulyssesrr,项目名称:carmen_lcad,代码行数:84,代码来源:app-match-SIFT-database.C

示例2: dc

void ColorPanel::OnPaint(wxPaintEvent& event)
{
  wxPaintDC dc(this);
  m_DC = &dc;

  dc.SetBackground(*wxBLACK_BRUSH);
  dc.Clear();

  m_UseGC = false;

  wxGraphicsContext* gc = NULL;
  if( wGui.isrendergc(wxGetApp().getIni())) {
    m_UseGC = true;
    gc = wxGraphicsContext::Create(this);
    m_GC = gc;
#ifdef wxANTIALIAS_DEFAULT
    gc->SetAntialiasMode(wxANTIALIAS_DEFAULT);
#endif
  }

  int w = 0;
  int h = 0;
  GetSize(&w, &h);

  setPen(*wxLIGHT_GREY, 1, wxDOT);
  float h10 = (float)h / 10.0;
  for( int i = 1; i < 10; i++) {
    //dc.DrawLine( 0, i*h10, w, i*h10 );
    drawLine( 0, i*h10, w, i*h10 );
  }

  int curinterval = -1;
  if( m_Hour != -1 ) {
    curinterval = (m_Hour * 60 + m_Min) / 30;
  }
  float w23 = (float)w / 23.0;
  float w47 = (float)w / 47.0;
  for( int i = 0; i < 48; i++) {
    if( curinterval != -1 && curinterval == i ) {
      setPen(wxColor( 0, 50, 0 ), 1, wxSOLID);
      setBrush( wxColor( 0, 50, 0 ));
      drawRectangle(i * w47 + 1, 0, w47, h);
    }

    if( i == m_Selection ) {
      setPen(*wxLIGHT_GREY, 3, wxDOT);
      dc.SetPen( *wxLIGHT_GREY_PEN );
      drawLine( i * w47, 0, i * w47, h );
    }
    else if( i > 0 && i < 47 ){
      setPen(*wxLIGHT_GREY, 1, wxDOT);
      drawLine( i * w47, 0, i * w47, h );
    }

  }

  TraceOp.trc( "colorpanel", TRCLEVEL_INFO, __LINE__, 9999, "width=%d height=%d", w, h );

  if( m_Weather != NULL ) {

    iONode colorProps[48] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                             NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                             NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                             NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};

    iONode color = wWeather.getweathercolor(m_Weather);
    while(color != NULL) {
      int hour = wWeatherColor.gethour(color);
      int min  = wWeatherColor.getminute(color);
      if( hour < 24 && hour >= 0 && min < 60 && min >= 0) {
        colorProps[(hour*60+min)/30] = color;
      }
      color = wWeather.nextweathercolor(m_Weather, color);
    }

    TraceOp.trc( "colorpanel", TRCLEVEL_INFO, __LINE__, 9999, "check if all 30 mins are there..." );
    iONode prevColorProps = colorProps[0];
    for( int i = 0; i < 48; i++ ) {
      if( colorProps[i] == NULL && prevColorProps == NULL) {
        TraceOp.trc( "colorpanel", TRCLEVEL_INFO, __LINE__, 9999, "exit..." );
        if( gc != NULL)
          delete gc;
        return;
      }
      if( colorProps[i] == NULL && prevColorProps != NULL) {
        colorProps[i] = prevColorProps;
      }
      TraceOp.trc( "colorpanel", TRCLEVEL_DEBUG, __LINE__, 9999, "i=%d", i );
      prevColorProps = colorProps[i];
    }

    TraceOp.trc( "colorpanel", TRCLEVEL_INFO, __LINE__, 9999, "draw the color table..." );

    float ystep = (float)h / 255.0;

    if( m_White ) {
      setPen(wxColor( m_White1R, m_White1G, m_White1B ), 3, wxSOLID);
      int start = wWeatherColor.getwhite(colorProps[0]);
      for( int i = 1; i < 48; i++ ) {
        int val = wWeatherColor.getwhite(colorProps[i]);
//.........这里部分代码省略.........
开发者ID:KlausMerkert,项目名称:FreeRail,代码行数:101,代码来源:colorpanel.cpp

示例3: drawLine

void VoodooGraphics::drawLine(QPoint p1, QPoint p2)
{
    drawLine(p1.x(), p1.y(), p2.x(), p2.y(), color);
}
开发者ID:oivoodoo,项目名称:MoonWalker,代码行数:4,代码来源:voodoographics.cpp

示例4: while

vector<vector3df> Editor::startEditor(){

	myRecEditor->startEventProcess();
#ifdef EDITOR_VIEW
	myRecEditorView->startEventProcess();
#endif
	bool leftPress = false;
	mouseWheelCurr = 0;
	double value = 0;
	CAMPOSX = 0;
	CAMPOSY = 0;
	CAMPOSZ = CAM_POS_DEFAULT;
	while (deviceEditor->run())
	{
		mouseWheelCurr = (int)(myRecEditor->mouseWheel()*1.29);

		if (currentEksen == EKSEN_X)
			X = mouseWheelCurr;
		else
			X = myRecEditor->mouseX() - EDITOR_HALF_SCREEN_SIZE;

		if (currentEksen == EKSEN_Y)
			Y = mouseWheelCurr;
		else{
			Y = (EDITOR_HALF_SCREEN_SIZE - myRecEditor->mouseY());
		}

		if (currentEksen == EKSEN_X)
			Z = (myRecEditor->mouseX() - EDITOR_HALF_SCREEN_SIZE);
		else if (currentEksen == EKSEN_Y)
			Z = EDITOR_HALF_SCREEN_SIZE - myRecEditor->mouseY();
		else
			Z = mouseWheelCurr;


		driverEditor->beginScene(true, true, SColor(204, 204, 204, 204));
#ifdef EDITOR_VIEW
		driverEditorView->beginScene(true, true, SColor(204, 204, 204, 204));
#endif
		cameraCalibration(myRecEditor, editorCam);
		if (myRecEditor->keyDown(KEY_KEY_W)){ // ....  EVENT HANDLERS  .... 
			currentEksen = EKSEN_Y;
			deviceEditor->setWindowCaption(L"Editor Platform  X - Z Ekseni ");
			editorParentNode->setRotation(vector3df(((int)(editorParentNode->getRotation().X + NODE_ROTATION_SPEED)) % ROTATION_LIMIT, 0, 0));
		}
		else if (myRecEditor->keyDown(KEY_KEY_S)){
			currentEksen = EKSEN_Z;
			deviceEditor->setWindowCaption(L"Editor Platform  X - Y Ekseni ");
			editorCam->setPosition(vector3df(0, 0, CAM_POS_DEFAULT + (mouseWheelCurr * CAM_POS_INC)));
			editorParentNode->setRotation(vector3df(0, 0, 0));
			CAMPOSX = 0;
			CAMPOSY = 0;
			CAMPOSZ = CAM_POS_DEFAULT;
		}
		else if (myRecEditor->keyDown(KEY_KEY_A)){
			currentEksen = EKSEN_X;
			deviceEditor->setWindowCaption(L"Editor Platform  Y - Z Ekseni ");
			editorParentNode->setRotation(vector3df(0, ((int)(editorParentNode->getRotation().Y + NODE_ROTATION_SPEED)) % ROTATION_LIMIT, 0));
		}
		else if (myRecEditor->keyDown(KEY_KEY_D)){
			currentEksen = EKSEN_Z;
			deviceEditor->setWindowCaption(L"Editor Platform  X - Y Ekseni ");
			editorParentNode->setRotation(vector3df(0, 0, ((int)(editorParentNode->getRotation().Z + NODE_ROTATION_SPEED)) % ROTATION_LIMIT));
		}
		else if (myRecEditor->keyDown(KEY_KEY_P))
		{
			stopEditor();
		}

		if (myRecEditor->leftMousePressed()){
			if (!leftPress)
				vFirst = vLast; // Clear Buffer.
			drawLine();
			leftPress = true;
		}
		if (myRecEditor->leftMouseReleased()){
			if (leftPress){
				vFirst = vLast; // Clear buffer.
				leftPress = false;
			}
		}
		if (myRecEditor->rightMouseDown()){

			drawLine();
		}
		if (myRecEditor->keyDown(KEY_KEY_C))
		{
			positionNodes.clear();
			smgrEditor->clear();
			editorParentNode = smgrEditor->addEmptySceneNode();
			editorParentNode->setVisible(true);
			editorChildNode = smgrEditor->addSphereSceneNode();
			nodeEditorCurrMouse = editorChildNode->clone();

			if (nodeEditorCurrMouse && editorChildNode){

				editorParentNode->setVisible(true);
				editorChildNode->setMaterialFlag(EMF_LIGHTING, false);
				editorChildNode->setScale(editorChildNode->getScale()*0.60f);
#if defined(_WIN32) || defined(_WIN64)
//.........这里部分代码省略.........
开发者ID:alicanozer,项目名称:CSE396-LedCube-Windows,代码行数:101,代码来源:Editor.cpp

示例5: drawDebugPaths

static void drawDebugPaths() {
	
	GRenderer->SetRenderState(Renderer::DepthTest, false);
	
	for(long i = 0; i < nbARXpaths; i++) {
		
		ARX_PATH * path = ARXpaths[i];
		if(!path) {
			continue;
		}
		
		Vec3f center = Vec3f_ZERO;
		int n = 0;
		
		std::vector<Vec3f> points;
		for(long i = 0; i < path->nb_pathways; i++) {
			const ARX_PATHWAY & node = path->pathways[i];
			Vec3f pos = path->pos + node.rpos;
			points.push_back(pos);
			center += pos, n++;
			if(node.flag == PATHWAY_BEZIER) {
				// Interpolate bezier curve by creating linear segments
				if(i + 2 >= path->nb_pathways) {
					break;
				}
				const size_t nsegments = 20;
				for(size_t j = 0; j < nsegments; j++) {
					points.push_back(path->interpolateCurve(i, float(j) / nsegments));
				}
				i++; // Skip the control point
			}
		}
		
		// Zones only check the bounding box for the y coordinate - adjust display for that
		if(path->height > 0) {
			for(size_t i = 0; i < points.size(); i++) {
				points[i].y = path->bbmin.y;
			}
		}
		
		if(path->height != 0 || ((path->flags & PATH_LOOP) && points.size() > 0)) {
			points.push_back(points[0]);
		}
		
		Color color = (path->height != 0) ? Color::green : Color::red;
		
		for(size_t i = 0; i + 1 < points.size(); i++) {
			drawLine(points[i], points[i + 1], color);
		}
		
		if(path->height > 0) {
			Vec3f offset(0.f, (path->bbmax.y - path->bbmin.y), 0.f);
			for(size_t i = 0; i + 1 < points.size(); i++) {
				drawLine(points[i] + offset, points[i + 1] + offset, color);
			}
			for(size_t i = 0; i < points.size(); i++) {
				drawLine(points[i], points[i] + offset, color);
			}
		}
		
		// Display the name and controlling entity for close zones
		if(!path->name.empty() || !path->controled.empty()) {
			if(path->height > 0) {
				center = (path->bbmin + path->bbmax) / 2.f;
			} else if(n != 0) {
				center /= float(n);
			} else {
				center = path->pos;
			}
			if(closerThan(center, player.pos, DebugTextMaxDistance)) {
				std::string controlledby;
				if(!path->controled.empty()) {
					controlledby = "Controlled by: " + path->controled;
				}
				Color textcolor = color * 0.5f + Color::gray(0.5f);
				drawTextAt(hFontDebug, center, path->name, textcolor, controlledby);
			}
		}
		
	}
	
	GRenderer->SetRenderState(Renderer::DepthTest, true);
	
}
开发者ID:grimtraveller,项目名称:ArxLibertatis,代码行数:84,代码来源:DrawDebug.cpp

示例6: drawLine

void	GLDebugDrawer::drawLine(const btVector3& from,const btVector3& to,const btVector3& color)
{
	drawLine(from,to,color,color);
}
开发者ID:AJ92,项目名称:Engine,代码行数:4,代码来源:GLDebugDrawer.cpp

示例7: pen

void TempChart::drawChart(QPainter *p)
{
    EventData &ed = EventData::getInstance();
//    if (ed.getWeather().getSize(weatherId)>1)
    {
        p->setBrush(QBrush(color));
        QPen pen(color);
        pen.setWidth(2);
        p->setPen(pen);
        p->setRenderHint(QPainter::Antialiasing);

        int sz = last - first + 1;

        if (sz <= 0)
            return;

        double xFactor1 = ((double)paintRect.width()) / (double)sz;//(ed.getWeather().getSize(weatherId));
        double yFactor = ((double)paintRect.height()-40.0) / (double)(tMax-tMin);

        double x = paintRect.left(), j1 = x + xFactor1;

        double y1 = (double)paintRect.bottom();// - (double)(ed.getWeather().getWeatherData(weatherId)[first].getValue()-tMin) * yFactor;
        double y2 = (double)paintRect.bottom();// - (double)(ed.getWeather().getWeatherData(trackTempId)[first].getValue()-tMin) * yFactor;

        if (first < ed.getWeather().getWeatherData(weatherId).size())
            y1 -= (double)(ed.getWeather().getWeatherData(weatherId)[first].getValue()-tMin) * yFactor;

        if (first < ed.getWeather().getWeatherData(trackTempId).size())
            y2 -= (double)(ed.getWeather().getWeatherData(trackTempId)[first].getValue()-tMin) * yFactor;

        int i = first;
        pen.setColor(color);
        p->setPen(pen);

        int end = ed.getWeather().getWeatherData(weatherId).size() > ed.getWeather().getWeatherData(trackTempId).size() ?
                  ed.getWeather().getWeatherData(weatherId).size() : ed.getWeather().getWeatherData(trackTempId).size();

        for (; i < last + 1 && i < end; ++i, j1 += xFactor1)
        {
            double y3 = (double)paintRect.bottom();// - (double)(ed.getWeather().getWeatherData(weatherId)[i].getValue()-tMin) * yFactor;
            double y4 = (double)paintRect.bottom();// - (double)(ed.getWeather().getWeatherData(trackTempId)[i].getValue()-tMin) * yFactor;

            if (i < ed.getWeather().getWeatherData(weatherId).size())
                y3 -= (double)(ed.getWeather().getWeatherData(weatherId)[i].getValue()-tMin) * yFactor;

            if (i < ed.getWeather().getWeatherData(trackTempId).size())
                y4 -= (double)(ed.getWeather().getWeatherData(trackTempId)[i].getValue()-tMin) * yFactor;

            double ty1 = y1, ty3 = y3, ty2 = y2, ty4 = y4;

            pen.setColor(color);
            p->setPen(pen);
            drawLine(p, x, ty1, j1, ty3);

            pen.setColor(trackTempCol);
            p->setPen(pen);
            drawLine(p, x, ty2, j1, ty4);

            x = j1;
            y1 = y3;
            y2 = y4;
        }
//        i = 1;
//        x = paintRect.left();

//        pen.setColor(trackTempCol);
//        p->setPen(pen);
//        for (; i < ed.weatherData[trackTempId].size(); ++i, j2 += xFactor2)
//        {
//            double y4 = (double)paintRect.width() - (double)(ed.weatherData[trackTempId][i].getValue()-tMin) * yFactor;
//            double midx = (j2 + x)/2;

//            p->drawLine(x, y2, midx, y2);
//            p->drawLine(midx, y2, midx, y4);
//            p->drawLine(midx, y4, j2, y4);

//            x = j2;
//            y2 = y4;
//        }
    }
}
开发者ID:primijos,项目名称:f1lt,代码行数:81,代码来源:weatherchart.cpp

示例8: drawTriangle

// draw a triangle!
void drawTriangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color)
{
    drawLine(x0, y0, x1, y1, color);
    drawLine(x1, y1, x2, y2, color);
    drawLine(x2, y2, x0, y0, color); 
}
开发者ID:blaezec,项目名称:stm32f4,代码行数:7,代码来源:TFTLCD.c

示例9: drawLine

	void PhysicsDebugDraw::drawLine( const btVector3& from, const btVector3& to, const btVector3& fromColor, const btVector3& toColor )
	{
		drawLine( from, to, fromColor );
	}
开发者ID:IreNox,项目名称:tiki3,代码行数:4,代码来源:physicsdebugdraw.cpp

示例10: sin

/*!
 * \brief draw a grid within the given image
 * \param img image to be returned
 * \param img_width width of the image
 * \param img_height height of the image
 * \param centre_x x centre point of the grid
 * \param centre_y y centre point of the grid
 * \param rotation rotation angle of the grid  radians
 * \param columns number of grid columns
 * \param rows number of grid rows
 * \param r red
 * \param g green
 * \param b blue
 * \param linewidth line width
 */
void drawing::drawGrid(
    unsigned char* img,
    int img_width,
    int img_height,
    int centre_x,
    int centre_y,
    float rotation,
    float size_width,
    float size_height,
    int columns,
    int rows,
    int r,
    int g,
    int b,
    int linewidth)
{
    // draw the columns
    for (int col = 0; col <= columns; col++)
    {
        float grid_x = ((col * size_width) / (float)columns) - (size_width/2);
        int prev_x = 0;
        int prev_y = 0;
        for (int row = 0; row <= rows; row += rows)
        {
            float grid_y = ((row * size_height) / (float)rows) - (size_height/2);
            float hyp = (float)sqrt((grid_x*grid_x) + (grid_y*grid_y));
            float angle = 0;
            if (hyp > 0)
            {
                angle = (float)asin(grid_x / hyp);
                if (grid_y < 0) angle = (float)(PI*2)-angle;
            }
            angle += rotation;

            int x = (int)(centre_x + (hyp * sin(angle)));
            int y = (int)(centre_y + (hyp * cos(angle)));

            if (row > 0)
            {
                drawLine(img, img_width, img_height, prev_x, prev_y, x, y,
                         r, g, b, linewidth, false);
            }

            prev_x = x;
            prev_y = y;
        }
    }

    // draw the rows
    for (int row = 0; row <= rows; row ++)
    {
        float grid_y = ((row * size_height) / (float)rows) - (size_height/2);
        int prev_x = 0;
        int prev_y = 0;
        for (int col = 0; col <= columns; col += columns)
        {
            float grid_x = ((col * size_width) / (float)columns) - (size_width/2);
            float hyp = (float)sqrt((grid_x*grid_x) + (grid_y*grid_y));
            float angle = 0;
            if (hyp > 0)
            {
                angle = (float)asin(grid_x / hyp);
                if (grid_y < 0) angle = (float)(PI*2)-angle;
            }
            angle += rotation;

            int x = (int)(centre_x + (hyp * sin(angle)));
            int y = (int)(centre_y + (hyp * cos(angle)));

            if (col > 0)
            {
                drawLine(img, img_width, img_height, prev_x, prev_y, x, y,
                         r, g, b, linewidth, false);
            }

            prev_x = x;
            prev_y = y;
        }
    }

}
开发者ID:Artens,项目名称:openanpr,代码行数:96,代码来源:drawing.cpp

示例11: show

int BndsModifier::exec()
{
	/// Inicializa las 2 pantallas a negro.
	g_video->resetAllMain();
	g_video->resetAllSub();
	
	show();

	touchPosition touch;
	int pulsado;
	int pulsadoClick;
	int grosorX = 1;
	int grosorY = 2;
	bool tactil = false;
	int origenX = 0;
	int origenY = 0;
	
	/// Limites donde dibujar.
	int limXmin = 40 + 2;
	int limXmax = 256;
	int limYmin = 0;
	int limYmax = 171 - 2;
	
	u16* buffer = (u16*) bgGetGfxPtr ( g_video->backgroundMain() );
	
	/// Espera hasta que no se este pulsando en la pantalla. Nos aseguramos de
	/// no estar pintando antes de tiempo.
	while (1) {
	    scanKeys();
	    touchRead(&touch);
	    pulsado = keysHeld();
	    if (pulsado & KEY_TOUCH) {
	    } else {
		break;
	    } // end if
	} // end while


	while (1) {
	    scanKeys();
	    touchRead(&touch);
	    pulsado = keysHeld();
	    pulsadoClick = keysDown();
	    
	
	    if ((pulsado & KEY_TOUCH) && ((touch.px >= limXmin) && (touch.px <= limXmax) && (touch.py >= limYmin) && (touch.py <= limYmax)) ) {
		/// Se esta pulsando en la pantalla tactil.
		if (tactil == false) {
		    /// Se acaba de pulsar en la pantalla tactil. Se registra la posicion inicial.
		    origenX = touch.px;
		    origenY = touch.py;
		    tactil = true;
		} // end if
		
		//drawRectangle8bpp ( touch.px - (grosorX / 2), touch.py - (grosorY / 2), touch.px + (grosorX / 2), touch.py + (grosorY / 2), 1, buffer);
		drawLine(origenX, origenY, touch.px, touch.py, grosorX, grosorY, 0, buffer);
		
		/// Registra para el proximo dibujado.
		origenX = touch.px;
		origenY = touch.py;
		
	    } else {
		/// No se esta pulsando la pantalla tactil.
		tactil = false;
	    } // end if


	    if ( (pulsado & KEY_L) && (pulsado & KEY_R)) {
		/// Resetea la pantalla
		clearCanvas();
	    } // end if

	    if (pulsado & KEY_A) {
		/// Se pulsa la tecla A (aceptar).
		return 1;
	    } // end if

	    /// Si se pulsa en el boton 'aceptar'.
	    if ( (pulsadoClick & KEY_TOUCH) &&
		  (touch.px >= 180) && (touch.px <= 255 ) &&
		  (touch.py >= 175) && (touch.py <= 192 ) ) {

		  /// Se guarda la imagen en disco
		  time_t seconds;
		  seconds = time (NULL);
	    
		  string sec;
		  stringstream out;
		  out << seconds;
		  sec = out.str();
	    
		  string nombreArchivo = "tmp_ndsbulmatpv_" + sec + ".bmp.base64";
		  screenshotToBmp1BitBase64(nombreArchivo.c_str());
		  m_nombreArchivo = nombreArchivo;
	      
		  return 1;
	    } // end if

	    /// Si se pulsa en el boton 'cancelar'.
	    if ( (pulsadoClick & KEY_TOUCH) &&
//.........这里部分代码省略.........
开发者ID:JustDevZero,项目名称:bulmages,代码行数:101,代码来源:bndsmodifier.cpp

示例12: display

void display(){
    int i;
    int sides = SIDES[WhichSides];

    glutSetWindow(main_window);
    glClear(GL_COLOR_BUFFER_BIT);

    glColor3f(0.3f, 0.0f, 0.4f);

    /* drawing the viewport */
    glBegin(GL_POLYGON);
    /* this is not the real viewport. We will clip to this
     * area later on. */
    glVertex2f(VIEWPORT_MARGIN, VIEWPORT_MARGIN);
    glVertex2f(VIEWPORT_MARGIN, Wb - VIEWPORT_MARGIN);
    glVertex2f(Wr - VIEWPORT_MARGIN, Wb - VIEWPORT_MARGIN);
    glVertex2f(Wr - VIEWPORT_MARGIN, VIEWPORT_MARGIN);
    glEnd();

    /* draw the cube */
    glColor3f(1.0,0.0,0.0);
    drawLine(0, 0, 0,
    	     CubeSize, 0, 0);
    drawLine(CubeSize, 0, 0,
    	     CubeSize, CubeSize, 0);
    drawLine(CubeSize, CubeSize, 0,
    	     0, CubeSize, 0);
    drawLine(0, CubeSize, 0,
    	     0, 0, 0);
    glColor3f(1.0,0.3,0.0);
    drawLine(CubeSize,0,CubeSize,
    	     CubeSize,CubeSize,0);

    glColor3f(0.0,1.0,0.0);
    drawLine(0, 0, CubeSize,
    	     CubeSize, 0, CubeSize);
    drawLine(CubeSize, 0, CubeSize,
    	     CubeSize, CubeSize, CubeSize);
    drawLine(CubeSize, CubeSize, CubeSize,
    	     0, CubeSize, CubeSize);
    drawLine(0, CubeSize, CubeSize,
    	     0, 0, CubeSize);

    glColor3f(0.0,1.0,1.0);
    drawLine(0, 0, 0,
    	     0, 0, CubeSize);
    drawLine(CubeSize, 0, 0,
    	     CubeSize, 0, CubeSize);
    drawLine(CubeSize, CubeSize, 0,
    	     CubeSize, CubeSize, CubeSize);
    drawLine(0, CubeSize, 0,
    	     0, CubeSize, CubeSize);

    glutSwapBuffers();

}
开发者ID:llovett,项目名称:2dcube,代码行数:56,代码来源:2dcube.cpp

示例13: findRow

void KIconEditGrid::mouseReleaseEvent( QMouseEvent *e )
{
  if(!e || (e->button() != LeftButton))
    return;

  int row = findRow( e->pos().y() );
  int col = findCol( e->pos().x() );
  btndown = false;
  end.setX(col);
  end.setY(row);
  int cell = row * numCols() + col;

  switch( tool )
  {
    case Eraser:
      currentcolor = TRANSPARENT;
    case Freehand:
    {
      if(!img->valid(col, row))
        return;
      setColor( cell, currentcolor );
      //if ( selected != cell )
      //{
        //modified = true;
        int prevSel = selected;
        selected = cell;
        repaint((prevSel%numCols())*cellsize,(prevSel/numCols())*cellsize, cellsize, cellsize, false);
        repaint(col*cellsize,row*cellsize, cellsize, cellsize, false);
        //updateCell( prevSel/numCols(), prevSel%numCols(), FALSE );
        //updateCell( row, col, FALSE );
        *((uint*)img->scanLine(row) + col) = colorAt(cell);
        p = *img;
      //}
      break;
    }
    case Ellipse:
    case Circle:
    case FilledEllipse:
    case FilledCircle:
    {
      drawEllipse(true);
      break;
    }
    case FilledRect:
    case Rect:
    {
      drawRect(true);
      break;
    }
    case Line:
    {
      drawLine(true);
      break;
    }
    case Spray:
    {
      drawSpray(QPoint(col, row));
      break;
    }
    case FloodFill:
    {
      QApplication::setOverrideCursor(waitCursor);
      drawFlood(col, row, colorAt(cell));
      QApplication::restoreOverrideCursor();
      updateColors();
      emit needPainting();
      p = *img;
      break;
    }
    case Find:
    {
      currentcolor = colorAt(cell);
      if ( selected != cell )
      {
        int prevSel = selected;
        selected = cell;
        repaint((prevSel%numCols())*cellsize,(prevSel/numCols())*cellsize, cellsize, cellsize, false);
        repaint(col*cellsize,row*cellsize, cellsize, cellsize, false);
        //updateCell( prevSel/numCols(), prevSel%numCols(), FALSE );
        //updateCell( row, col, FALSE );
      }

      break;
    }
    default:
      break;
  }
  emit changed(QPixmap(p));
  //emit colorschanged(numColors(), data());
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:90,代码来源:kicongrid.cpp

示例14: doTextInput

int doTextInput(textInput* input) {
  if(input->type==INPUTTYPE_NORMAL) {
    drawFkeyLabels(-1, -1, -1, (input->symbols? 0x02A1 : -1), 0x0307); // CHAR, A<>a
  }
  int wasInClip=0;
  if (input->key)
    input->cursor = EditMBStringChar((unsigned char*)input->buffer, input->charlimit, input->cursor,
                                     input->key);
  int widthForSyscalls = input->width;
  if(input->width == 21) {
    widthForSyscalls = 20;
    clearLine(1, input->y); // remove aestethically unpleasing bit of background at the end of the field
  }
  while(1) {
    if(input->forcetext && strlen(input->buffer)==0) {
      input->buffer[0]='\xd8';
      input->buffer[1]='\x0';
    }
    DisplayMBString2(0, (unsigned char*)input->buffer, input->start, input->cursor, 0, input->x,
                     input->y*24-24, widthForSyscalls+input->x, input->width==21? 0 : 1);
    
    drawLine(input->x*18-18, input->y*24-1,
             input->width == 21 ? LCD_WIDTH_PX-1 : input->width*18+input->x*18-18-1,
             input->y*24-1, COLOR_GRAY);
    drawLine(input->x*18-18, input->y*24+23,
             input->width == 21 ? LCD_WIDTH_PX-1 : input->width*18+input->x*18-18-1,
             input->y*24+23, COLOR_GRAY);
    if(input->width != 21) {
      //vertical lines, start and end
      drawLine(input->x*18-18, input->y*24-1, input->x*18-18, input->y*24+23, COLOR_GRAY);
      drawLine((input->x*18-18)+18*input->width,
               input->y*24-1, (input->x*18-18)+18*input->width, input->y*24+23, COLOR_GRAY);
    }
    if(input->type==INPUTTYPE_DATE) {
      //vertical lines: dd, mm and yyyy separators
      switch(getSetting(SETTING_DATEFORMAT)) {
        case 0:
        case 1:
          drawLine((input->x*18-18)+18*2, input->y*24-1,
                   (input->x*18-18)+18*2, input->y*24+22, COLOR_GRAY);
          drawLine((input->x*18-18)+18*4+1, input->y*24-1,
                   (input->x*18-18)+18*4+1, input->y*24+23, COLOR_GRAY);
          break;
        case 2:
          drawLine((input->x*18-18)+18*4, input->y*24-1,
                   (input->x*18-18)+18*4, input->y*24+22, COLOR_GRAY);
          drawLine((input->x*18-18)+18*6+1, input->y*24-1,
                   (input->x*18-18)+18*6+1, input->y*24+23, COLOR_GRAY);
          break;
      }
    } else if(input->type==INPUTTYPE_TIME) {
      //vertical lines: hh, mm and ss separators
      drawLine((input->x*18-18)+18*2, input->y*24-1,
               (input->x*18-18)+18*2, input->y*24+23, COLOR_GRAY);
      drawLine((input->x*18-18)+18*4, input->y*24-1,
               (input->x*18-18)+18*4, input->y*24+23, COLOR_GRAY);
    }
    int keyflag = GetSetupSetting( (unsigned int)0x14);
    if(input->type==INPUTTYPE_NORMAL) {
      if(keyflag == 0x02) {
        // in clip mode
        wasInClip=1;
        drawFkeyLabels(0x0034, 0x0069); // COPY (white), CUT (white)
      } else if(wasInClip) {
        // clear, because we were in clip mode before
        wasInClip=0;
        drawFkeyLabels(0,0); // empty first two
      }
    }
    mGetKey(&input->key);
    if (GetSetupSetting((unsigned int)0x14) == 0x01 ||
        GetSetupSetting((unsigned int)0x14) == 0x04 ||
        GetSetupSetting( (unsigned int)0x14) == 0x84) {
      keyflag = GetSetupSetting( (unsigned int)0x14); // make sure the flag we're using is the
      // updated one. we can't update always because that way alpha-not-lock will cancel when F5 is
      // pressed.
    }
    if(input->key == KEY_CTRL_EXE || (input->key == KEY_CTRL_F6 && input->acceptF6)) {
      // Next step
      if(!input->forcetext || (strlen((char*)input->buffer) > 0 && input->buffer[0]!='\xd8')) {
        // input can be empty, or it already has some text
        Cursor_SetFlashOff(); return INPUT_RETURN_CONFIRM;
      } else {
        mMsgBoxPush(4);
        multiPrintXY(3, 2, "Field can't be\nleft blank.",
                     TEXT_MODE_TRANSPARENT_BACKGROUND, TEXT_COLOR_BLACK);
        closeMsgBox();
      }
    } else if(input->key == KEY_CTRL_EXIT) {
      // Aborted
      Cursor_SetFlashOff(); return INPUT_RETURN_EXIT;
    } else if(input->key == KEY_CTRL_F1 || input->key == KEY_CTRL_F2) {  
      Cursor_SetFlashOff(); return INPUT_RETURN_KEYCODE;
    } else if(input->key == KEY_CTRL_F4 && input->type == INPUTTYPE_NORMAL && input->symbols) {
      short character = selectCharacterAux();
      if (character)
        input->cursor = EditMBStringChar((unsigned char*)input->buffer, input->charlimit,
                                         input->cursor, character);
    } else if(input->key == KEY_CTRL_F5 && input->type == INPUTTYPE_NORMAL) {
      // switch between lower and upper-case alpha
//.........这里部分代码省略.........
开发者ID:gbl08ma,项目名称:utilities,代码行数:101,代码来源:inputGUI.cpp

示例15: drawLine

void TestWidget::paint(const Rect& rect)
{
    drawLine(Point(0, 0), Point(size().w, size().h));
}
开发者ID:IlyaSkriblovsky,项目名称:lx,代码行数:4,代码来源:TestWidget.cpp


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