예제 #1
0
void histograma::setDatos(QPixmap pixmap){
    QRgb pixel;
    int red, green,blue,gray;

    R =new QVector<double>(256);
    G =new QVector<double>(256);
    B =new QVector<double>(256);
    Gr =new QVector<double>(256);
    X= new QVector<double>(256);


    for (int i=0; i<256; ++i) X->operator [](i)=i;

    for(int x=0;x<pixmap.width();x++){
        for(int y=0;y<pixmap.height();y++){
            pixel=pixmap.toImage().pixel(x,y);

            red=qRed(pixel);
            green=qGreen(pixel);
            blue=qBlue(pixel);
            gray=(red * 11 + green * 16 + blue * 5)/32;

            R->operator [](red)++;
            G->operator [](green)++;
            B->operator [](blue)++;
            Gr->operator [](gray)++;

        }
    }

    Dibujar(ui->customPlot);

    ui->customPlot->replot();
}
예제 #2
0
파일: P1.cpp 프로젝트: keymanky/sites
      void Mover(float nx, float ny)
      {
	   if(ver)
	   {
		  Ocultar();
		  x=nx;
		  y=ny;
		  Dibujar();
	   }
	   else
	   {
		  x=nx;
		  y=ny;
		  Dibujar();
	   }

      }
예제 #3
0
파일: P1.cpp 프로젝트: keymanky/sites
      void Mover(float n)
      {
	   if(ver)
	   {
		  Ocultar();
		  x=x+n;
		  x1=x1+n;
		  Dibujar();
	   }
	   else
	   {
		  x=x+n;
		  x1=x1+n;
		  Dibujar();
	   }

      }
예제 #4
0
파일: 3.cpp 프로젝트: keymanky/sites
      void Mover(n)
      {
	   if(ver)
	   {
		  Ocultar();
		  x=x+n;
		  y=y+n;
		  Dibujar();
	   }
	   else
	   {
		  x=x+n;
		  y=y+n;
		  Dibujar();
	   }

      }
예제 #5
0
void Game::Iniciar()
{
	const sf::Input& input = m_Window.GetInput();
	
	float dt;
	while( m_Window.IsOpened() )
	{
		//Atrapamos los eventos para cerra la ventana
		while( m_Window.GetEvent(m_Evento) )
		{
			switch( m_Evento.Type )
			{
			case sf::Event::Closed:
					m_Window.Close();
				break;
				
			case sf::Event::KeyPressed:
				if( m_Evento.Key.Code == sf::Key::Escape)
					m_Window.Close();
				break;

			case sf::Event::KeyReleased:
				m_Pausa = !m_Pausa;
				#ifdef _DEBUG
					if( m_Pausa == true )
						std::cout<<"PAUSA..."<<std::endl;
					else
						std::cout<<"-------------------------------"<< std::endl;
				#endif
				break;
			}
		}
		dt = m_Window.GetFrameTime();

		Actualizar(dt);    //Actualizamos la escena

		Dibujar();       //Dibujamos todo el juego
	}
}