void KQtTester::testImageEffects() { QString report = QString("execute %1 times:\n").arg(g_nTimes); report += QString("none:\t%1\tms\n").arg(none()); m_pPainter->translate(g_img.width() + 10, 0); report += QString("gray:\t%1\tms\n").arg(gray()); m_pPainter->translate(g_img.width() + 10, 0); report += QString("watermark:\t%1\tms\n").arg(watermark()); m_pPainter->translate(g_img.width() + 10, 0); report += QString("bilevel:\t%1\tms\n").arg(bilevel()); m_pPainter->resetMatrix(); m_pPainter->translate(0, g_img.height() + 10); report += QString("lightBlue:\t%1\tms\n").arg(lightBlue()); m_pPainter->translate(g_img.width() + 10, 0); report += QString("darkBlue:\t%1\tms\n").arg(darkBlue()); m_pPainter->resetMatrix(); m_pPainter->translate(0, (g_img.height() + 10) * 2); report += QString("colorKey:\t%1\tms\n").arg(colorKey()); m_pPainter->translate(g_img.width() + 10, 0); report += QString("brightness:\t%1\tms\n").arg(brightness()); m_pPainter->translate(g_img.width() + 10, 0); report += QString("contrast:\t%1\tms\n").arg(contrast()); m_pPainter->translate(g_img.width() + 10, 0); report += QString("brown:\t%1\tms\n").arg(brown()); drawReport(report); }
void CustomWindow::resizeEvent(QResizeEvent *event) { Q_UNUSED(event); if(m_Cache != NULL) delete m_Cache; m_Cache = new QPixmap(size()); m_Cache->fill(Qt::transparent); QPainter painter(m_Cache); QColor darkBlue ( 50, 50, 50); QColor lightBlue(150, 150, 150); /********** Window's background **********/ QPolygon background; background << QPoint( 0, 16) << QPoint( 16, 0) << QPoint(width() - 1, 0) << QPoint(width() - 1, height() - 33) << QPoint(width() - 17, height() - 17) << QPoint( 272, height() - 17) << QPoint( 256, height() - 1) << QPoint( 16, height() - 1) << QPoint( 16, 272) << QPoint( 0, 256); painter.setPen (QPen (darkBlue)); painter.setBrush(QBrush(darkBlue)); painter.drawPolygon(background); /*****************************************/ /********** Window's frame **********/ QPolygon frame; frame << QPoint( 4, 20) << QPoint( 20, 4) << QPoint(width() - 4, 4) << QPoint(width() - 4, height() - 37) << QPoint(width() - 20, height() - 21) << QPoint( 268, height() - 21) << QPoint( 252, height() - 5) << QPoint( 20, height() - 5) << QPoint( 20, 268) << QPoint( 4, 252); painter.setPen (QPen(lightBlue)); painter.setBrush(Qt::NoBrush ); painter.drawPolygon(frame); /*****************************************/ m_SizeGrip.move (width() - 32, height() - 49); m_SizeGrip.resize( 32, 32); }
//---------------------------------------------------------------------------- void RoughPlaneParticle1::OnDisplay () { ClearScreen(); ColorRGB black(0, 0, 0); ColorRGB gray(128, 128, 128); ColorRGB blue(0, 0, 128); ColorRGB lightBlue(0, 0, 255); int x0, w0, x1, w1, i; Vector2d position; const double xScale = 1.25; const double wScale = 0.75; const int wOffset = 96; // Draw viscous friction path of motion. const int numVFPositions = (int)mVFPositions.size(); position = mVFPositions[0]; x0 = (int)(xScale*position.X() + 0.5); w0 = (int)(wScale*position.Y() + 0.5) + wOffset; x1 = x0; w1 = w0; for (i = 1; i < numVFPositions; ++i) { position = mVFPositions[i]; x1 = (int)(xScale*position.X() + 0.5); w1 = (int)(wScale*position.Y() + 0.5) + wOffset; DrawLine(x0, w0, x1, w1, lightBlue); x0 = x1; w0 = w1; } // Draw the mass. SetThickPixel(x1, w1, 2, blue); // Draw static friction path of motion. const int numSFPositions = (int)mSFPositions.size(); position = mSFPositions[0]; x0 = (int)(xScale*position.X() + 0.5); w0 = (int)(wScale*position.Y() + 0.5) + wOffset; x1 = x0; w1 = w0; for (i = 1; i < numSFPositions; ++i) { position = mSFPositions[i]; x1 = (int)(xScale*position.X() + 0.5); w1 = (int)(wScale*position.Y() + 0.5) + wOffset; DrawLine(x0, w0, x1, w1, gray); x0 = x1; w0 = w1; } // Draw the mass. SetThickPixel(x1, w1, 2, black); WindowApplication2::OnDisplay(); }
void NavMesh::Render() { Color lightBlue(0.1f, 0.2f, 0.8f, 0.3f); for(int i = 0; i < (int)mFaces.size(); i++) GLHelper::FillTri(*mFaces[i]->VertexA, *mFaces[i]->VertexB, *mFaces[i]->VertexC, lightBlue); for(int i = 0; i < (int)mEdges.size(); i++) GLHelper::DrawLine(*mEdges[i]->VertexA, *mEdges[i]->VertexB, mEdges[i]->Outside ? Color::Blue : Color::Green, 1.0f); for(int i = 0; i < (int)mVertices.size(); i++) GLHelper::DrawPoint(*mVertices[i], Color::White, 5.0f); }
// ************************************************ void getColourFromList(int idx,OpenMesh::Vec3uc& outColour) { OpenMesh::Vec3uc purple(92,75,81); OpenMesh::Vec3uc lightBlue(140,190,178); OpenMesh::Vec3uc lightYellow(242,235,191); OpenMesh::Vec3uc lightOrange(243,181,98); OpenMesh::Vec3uc lightPink(240,96,96); OpenMesh::Vec3uc otherBlue(95,172,190); outColour = otherBlue; if (idx == 1 ) outColour = purple; if (idx == 2 ) outColour = lightBlue; if (idx == 3 ) outColour = lightYellow; if (idx == 4 ) outColour = lightOrange; if (idx == 5 ) outColour = lightPink; if (idx == 6 ) outColour = otherBlue; }