void GfxBlockItem::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) { // paint background grid; items draw themselves QRectF bb = boundingRect(); QColor c(style().color("canvas-grid-color")); c.setAlphaF(style().real("canvas-grid-alpha")); p->setPen(QPen(c, style().real("canvas-grid-line-width"), Qt::SolidLine, Qt::FlatCap)); double dx = style().real("canvas-grid-spacing"); drawGrid(p, bb, dx); c = style().color("canvas-grid-major-color"); c.setAlphaF(style().real("canvas-grid-major-alpha")); p->setPen(QPen(c, style().real("canvas-grid-major-line-width"), Qt::SolidLine, Qt::FlatCap)); dx *= style().integer("canvas-grid-major-interval"); if (dx) drawGrid(p, bb, dx); }
int main(int argc, char const *argv[]) { int coordinates1[MAXCOORDINATES]; int coordinates2[MAXCOORDINATES]; if (argc < 2) { printf("Wrong number of files\n"); return 0; } do{ getLifeFile(argv[1], coordinates1); getLifeFile(argv[2], coordinates2); randomiseCoordinates(coordinates1); randomiseCoordinates(coordinates2); wrapAdjustmentCoordinates(coordinates1); wrapAdjustmentCoordinates(coordinates2); } while(checkCoordsOverlap(coordinates1, coordinates2)); drawGrid(coordinates1, coordinates2); evolveGame(coordinates1, coordinates2); drawGrid(coordinates1, coordinates2); printf("1: %d\n\n", count(coordinates1)); printf("2: %d\n\n", count(coordinates2)); return 0; }
void PHScrollerView::draw() { if (inertial && (inscroll.x || inscroll.y)) { move(inscroll); PHLowPassFilter(inscroll.x, 0, 1/60.0f, 4.0f); PHLowPassFilter(inscroll.y, 0, 1/60.0f, 4.0f); if (fabs(inscroll.x)<0.001) inscroll.x=0; if (fabs(inscroll.y)<0.001) inscroll.y=0; } drawGrid(1.0,0.05,PHColor(0,1,0,0.6)); drawGrid(0.5,0.025,PHColor(0,1,0,0.3)); drawGrid(0.1,0.015,PHColor(0,1,0,0.2)); if (content) { PHPoint p = content->position(); GLfloat vertices[] = { p.x, p.y+0.15, p.x-0.15, p.y, p.x+0.15, p.y, p.x, p.y-0.15 }; gm->setGLStates(PHGLBlending | PHGLVertexArray); gm->setColor(PHColor(1,0,0,1)); gm->vertexPointer(2, GL_FLOAT, 0, vertices); gm->applyShader(gm->solidColorShader()); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); } }
void Snake::draw() { node* ptr= tail; for(;ptr!=NULL; ptr=ptr->next) { glColor3f(0.0, 1.0, 0.0); drawGrid(ptr->xVal, ptr->yVal); } glColor3f(1.0, 0.0, 0.0); drawGrid(seed[0], seed[1]); if(counter==5) { glColor3f(0.0, 0.0, 1.0); drawGrid(special[0], special[1]); glColor3f(1.0, 1.0, 1.0); drawFourDigiNumber(countDown, edge+1, 20.0, 1.2); } glColor3f(1.0,1.0, 0.0); glBegin(GL_QUADS); glVertex2f(edge-0.5, -0.5); glVertex2f(edge, -0.5); glVertex2f(edge, edge-0.5); glVertex2f(edge-0.5, edge-0.5); glEnd(); glColor3f(1.0, 1.0, 1.0); drawFourDigiNumber(score, edge+1.0, 40.0, 1.2); }
/** Dessine la surface de jeu sur screen * screen : Surface où dessiner * sim : Surface à dessiner * grid : Dessine la grille si vrai **/ void drawGameMatrix(SDL_Surface *screen, Simulation *sim, int grid) { int x = 0, y = 0, i, j; int xCoin = sim->dispX - 0.5*sim->largeurCase*sim->nbCasesX; int yCoin = sim->dispY - 0.5*sim->largeurCase*sim->nbCasesY; for(i = 0; i < sim->nbCasesX; i++) { for(j = 0; j < sim->nbCasesY; j++) { if(sim->buffers[sim->actualBuffer][i][j]) { x = xCoin + i*sim->largeurCase; y = yCoin + j*sim->largeurCase; drawSquareAbsolute(screen, sim->largeurCase, x, y); } } } if(grid) { drawGrid(screen, sim->largeurCase, xCoin, yCoin, sim->nbCasesX, sim->nbCasesY); drawGrid(screen, sim->nbCasesX*sim->largeurCase/sqrt(sim->nbThread), xCoin, yCoin, sqrt(sim->nbThread), sqrt(sim->nbCasesY)); } }
/** * run * Run is the main control body of the program. It first prints the header which * contains directions on how to use the program then enters the paused state * in which the user may edit the population using a cursor controlled by the * arrow keys. If the user presses Enter, the simulation is started and will * continue until the user again presses Enter to pause or Esc to exit. **/ void run(int model[][ROWS]) { printHeader(); //prints directions drawBorder(GRIDCOLOR); //draws a border swapBuff(); int i = COLUMNS/2; //initializes position of cursor to middle of screen int j = ROWS/2; raw_key = 0x1C; //sets raw_key = ENTER while (raw_key != 0x01) { //loops until user hits Esc if (raw_key==0x1C) { //checks for enter pressed raw_key=0; waitVRetrace(); drawGrid(GRIDCOLOR); //draws grid on screen for edit mode drawSquare(i,j,SELCOLOR); //draws cursor at position on screen while (raw_key!=0x1C && raw_key!=0x01) { //loops until Esc or Enter waitVRetrace(); if (raw_key==0x48) { //up arrow has been pressed raw_key = 0; updateSquare(model,i,j); //erases cursor if (j>0) {j--;} //updates cursor position drawSquare(i,j,SELCOLOR); //draws cursor at new position } if (raw_key==0x50) { //down arrow has been pressed raw_key = 0; updateSquare(model,i,j); if (j<ROWS-1) {j++;} drawSquare(i,j,SELCOLOR); } if (raw_key==0x4B) { //left arrow has been pressed raw_key = 0; updateSquare(model,i,j); if (i>0) {i--;} drawSquare(i,j,SELCOLOR); } if (raw_key==0x4D) { //right arrow has been pressed raw_key = 0; updateSquare(model,i,j); if (i<COLUMNS-1) {i++;} drawSquare(i,j,SELCOLOR); } if (raw_key==0x39) { //spacebar has been pressed raw_key = 0; //flips the life state of current square if (model[i][j]==1) {model[i][j]=0;} else {model[i][j]=1;} } swapBuff(); } //clears raw key if enter was pressed if (raw_key==0x1C) {raw_key=0;} updateSquare(model,i,j); //erases cursor drawGrid(BGCOLOR); //erases grid for simulation mode while(raw_key!=0x01 && raw_key!=0x1C) { //loops until Esc or Enter updateModel(model); //simulates game of life and redraws squares waitVRetrace(); swapBuff(); } } } }
int TetrisGrid::removeLines() { int removed = 0; for(int i = 0; i < GRID_HEIGHT; i++) { bool removeThisRow = true; for(int j = 0; j < GRID_WIDTH; j++) { if(((*(grid[i]))[j]) == ' ') { removeThisRow = false; break; } } if(removeThisRow) { grid.remove(i); String* emptyLine = new String(T(" ")); grid.insert(0, emptyLine); removed++; if(removed == 4) { break; } } } drawGrid(); return removed; }
void BuzzWord::newGame() { gameOver = false; delete grid; drawGrid(); setCentralWidget(grid); }
int main() { char playerOne[10]; char playerTwo[10]; char mesgOne[50] = "Enter player one's name: "; char mesgTwo[50] = "Enter player two's name: "; initscr(); mvprintw(13, 1,"%s",mesgOne); getstr(playerOne); mvprintw(14, 1,"%s",mesgTwo); getstr(playerTwo); cbreak(); noecho(); drawGrid(); move(1,2); refresh(); //when you first start the game, the cursor is first space (1,2) gamePlay(playerOne, playerTwo); refresh(); getch(); endwin(); return 0; }
void autoMoveDown() { backupGrid(); cleanShape(g_CUR_CUBE); g_CUR_CUBE->moveDown(); if(isValidShapePos(g_CUR_CUBE) == false) { // move back && setShape g_CUR_CUBE->moveUp(); setShape(g_CUR_CUBE); // get next cube && draw it g_CUR_CUBE = g_NEXT_CUBE; if(isValidShapePos(g_CUR_CUBE) == false) { gameOver(); } Shape *s = createShape(); COORD ref_coord = {4, 2}; g_NEXT_CUBE = new Cube(ref_coord, s->shape, s->types); cleanNEXT(g_CUR_CUBE); drawNEXT(g_NEXT_CUBE); checkGrid(); } else { ; // do nothing } setShape(g_CUR_CUBE); drawGrid(); }
void Display() { glClear (GL_COLOR_BUFFER_BIT); glColor3f (1.0, 0.0, 0.0); pthread_mutex_lock(&command_mutex); cell_bin[0][0] = cell_bin[0][1] = cell_bin[1][0] = cell_bin[1][1] = 0; avg_fitness[0] = avg_fitness[1] = 0.0; coherence[0] = coherence[1] = 0.0; if (stop == false) { automata->coherenceModel(payoff_matrix,sim_info.pmut,cell_bin,avg_fitness,coherence); timer++; } //data_file << timer << " " << automata->gtFitness() << endl; glViewport(0,0,400,400); glColor3f(0,0,1); drawBorder(); drawGrid(); glViewport(400,0,400,400); glColor3f(0,0,1); drawBorder(); drawMonitor(); pthread_mutex_unlock(&command_mutex); glutSwapBuffers (); glutPostRedisplay(); }
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); }
////////////////////////////////////////////////// // This is called on a glutPostRedisplay ////////////////////////////////////////////////// static void OnRedisplay() { glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT ); glEnable( GL_DEPTH_TEST ); glEnable( GL_BLEND ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); // set up the projection matrix glMatrixMode( GL_PROJECTION ); glLoadIdentity(); gluPerspective( 80.0f, AppWindow::width / AppWindow::height, 0.01f, 1000.0f ); // initialize your matrix stack used for transforming your models glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); // !!!TODO!!!: replace the following with your own opengl commands! glTranslatef( 0, -10, 0 ); drawGrid(); // !!!TODO!!!: //////////////////////////////////////// // swaps the front and back frame buffers. // hint: you've been drawing on the back, offscreen, buffer. // This command then brings that framebuffer onscreen. glutSwapBuffers(); }
/*! */ 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 ); } }
static void drawPreview(struct colorDialog *c, ID2D1RenderTarget *rt) { D2D1_SIZE_F size; D2D1_RECT_F rect; double r, g, b; D2D1_COLOR_F color; D2D1_BRUSH_PROPERTIES bprop; ID2D1SolidColorBrush *brush; HRESULT hr; size = realGetSize(rt); rect.left = 0; rect.top = 0; rect.right = size.width; rect.bottom = size.height; drawGrid(rt, &rect); hsv2RGB(c->h, c->s, c->v, &r, &g, &b); color.r = r; color.g = g; color.b = b; color.a = c->a; ZeroMemory(&bprop, sizeof (D2D1_BRUSH_PROPERTIES)); bprop.opacity = 1.0; bprop.transform._11 = 1; bprop.transform._22 = 1; hr = rt->CreateSolidColorBrush(&color, &bprop, &brush); if (hr != S_OK) logHRESULT(L"error creating brush for preview", hr); rt->FillRectangle(&rect, brush); brush->Release(); }
void gyro_widget::refreshPixmap() { pixmap = QPixmap(size()); pixmap.fill(this, 0, 0); if(abs(gyro_x) < 2) gyro_x = 0; else gyro_x = multiplier_x * gyro_x; if(abs(gyro_y) < 2) gyro_y = 0; else gyro_y = multiplier_y * gyro_y; pos_x = (pos_x - gyro_x < 5) ? 5 : (pos_x - gyro_x); if(pos_x > width() - 5 ) pos_x = width() - 5; pos_y = (pos_y - gyro_y < 5) ? 5 : (pos_y - gyro_y); if(pos_y > height() - 5 ) pos_y = height() - 5; QPainter painter(&pixmap); painter.initFrom(this); drawGrid(&painter); drawSquare(&painter); update(); }
void display (void) { glClearDepth (1); glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); gluLookAt(120.0, 20.0, 140.0, 0.0, 0.0, 0.0, 0.0, 5.0, 0.0); float pos[]={10.0,90.0,-110.0,1.0}; //set the position glLightfv(GL_LIGHT0,GL_POSITION,pos); glEnable(GL_COLOR_MATERIAL); camera(); glPushMatrix(); glTranslatef(0, -30, 0); //glScalef(10,10,10); //glCallList(cube); glPopMatrix(); drawGrid(); //createHabitat(); drawWalls(); drawHabitat(); drawFood(); drawObject(); drawPredator(); //saveToDisk(); glutSwapBuffers(); }
void CSceneWidget::drawForeground(QPainter *painter, const QRectF &rect) { if (m_gridEnabled && m_cellWidth > 0) { drawGrid(painter); } QGraphicsView::drawForeground(painter, rect); }
void OpenGLTransformation::drawSub1() { glViewport(0, 0, windowWidth / 2, windowHeight); glScissor(0, 0, windowWidth / 2, windowHeight); glClearColor(0.1f, 0.1f, 0.1f, 1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); MatStack.matrixMode(tgt::MatrixStack::PROJECTION); MatStack.pushMatrix(); MatStack.loadMatrix(camera->getProjectionMatrix(glm::ivec2(windowWidth * 0.5f, windowHeight))); MatStack.matrixMode(tgt::MatrixStack::MODELVIEW); MatStack.pushMatrix(); MatStack.loadMatrix(camera->getViewMatrix()); // always draw the grid at the origin (before any modeling transform) drawGrid(10, 1); drawAxis(4); glm::mat4 cubeModel = glm::translate(glm::vec3(-0.5f)); MatStack.pushMatrix(); MatStack.loadMatrix(camera->getViewMatrix() * cubeModel); drawCube(); MatStack.popMatrix(); MatStack.matrixMode(tgt::MatrixStack::PROJECTION); MatStack.popMatrix(); MatStack.matrixMode(tgt::MatrixStack::MODELVIEW); MatStack.popMatrix(); }
void Render::draw(Camera *camera, Container& container) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glUseProgram(shader->getProgramID()); glEnableVertexAttribArray(0); glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0); //glEnableVertexAttribArray(1); //glBindBuffer(GL_ARRAY_BUFFER, colorbuffer); //glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, (void*)0); glEnableVertexAttribArray(2); glBindBuffer(GL_ARRAY_BUFFER, normalbuffer); glVertexAttribPointer(2, 3, GL_FLOAT, GL_FALSE, 0, (void*)0); glUniformMatrix4fv(camera->get_projection_location(), 1, GL_FALSE, camera->get_projection_matrix()); glUniformMatrix4fv(camera->get_view_location(), 1, GL_FALSE, camera->get_view_matrix()); glUniformMatrix4fv(camera->get_model_location(), 1, GL_FALSE, camera->get_model_matrix()); drawGrid(); drawContainer(container, camera); drawLayers(container.getLayers(), camera); glDisableVertexAttribArray(0); glDisableVertexAttribArray(1); glDisableVertexAttribArray(2); }
void cOutput::drawUnitPictureAndDescription(Uint32 ticks) { if(selectionListHead->getSuccessor() != NULL) { cSelection* sel = selectionListHead->getSuccessor(); //get the first priorized unit int typecycle = 0; int oldtype = -1; while(sel!=NULL) { Error("cycle to draw description and grid;", sel->getContent()->getType()); if(sel->getContent()->getType() != oldtype) { typecycle++; oldtype = sel->getContent()->getType(); } if(typecycle == priorizedNumber) { drawUnitDescription(sel->getContent()); //Draw the Grid drawGrid(sel->getContent(),ticks); break; } sel=sel->getSuccessor(); } } }
//-------------------------------------------------------------- void testApp::draw(){ if (tick == true){ x ++; tick = false; } // GLfloat lightpos[] = {.5, -1., -1., 0.}; // glLightfv(GL_LIGHT0, GL_POSITION, lightpos); // ofRect(x,y,10,10); vector<ofVec3f>::iterator p = positions.begin(); vector<ofColor>::iterator c = colours.begin(); //// //draw scene camera.begin(); light.draw(); ofPushMatrix(); ofTranslate(0,0,-1); drawShape(0.3,0.5,-1,0.2,0.6,0.2,x,x,x,top,bottom,front,back,left,right,1); drawShape(0.1,0.6,-0.5,0.8,0.5,0.2,x,x,x,top,bottom,front,back,left,right,1); drawShape(0.1,0.6,-0.5,0.8,0.5,0.2,x,x,x,top,bottom,front,back,left,right,0); drawShape(0,0,0,2,2,6,0,0,0,top,bottom,front,back,left,right,1); drawGrid(5.0f, 10.0f); ofPopMatrix(); camera.end(); ofSetColor(255,100,100); int row = 1; ofDrawBitmapString("ofxGrabCam", 10, row++ * 15); ofDrawBitmapString("Drag with left mouse to orbit", 10, row++ * 15); ofDrawBitmapString("Drag with right mouse to zoom", 10, row++ * 15); ofDrawBitmapString("Hold 'h' and drag with left mouse to pan", 10, row++ * 15); ofDrawBitmapString("Press 'r' to reset", 10, row++ * 15); row++; ofDrawBitmapString("This example", 10, row++ * 15); ofDrawBitmapString("Press 'c' to toggleCursorDraw", 10, row++ * 15); ofDrawBitmapString("Press 'u' to toggleFixUpwards", 10, row++ * 15); ofDrawBitmapString("Press 's' to save camera pose to savedPose", 10, row++ * 15); ofDrawBitmapString("Press 'l' to load camera pose from savedPose", 10, row++ * 15); //demonstrate resiliance to stray matrices // ofRotate(ofRandom(360), 0, 1, 0); // ofScale(ofRandom(30), ofRandom(30)); string info = "FPS: "+ofToString(cols[0],0)+"\n"; info += "D: "+ofToString(D, 5)+"\n"; ofSetColor(0); ofDrawBitmapString(info, 20, 20); }
//------------------------------------------------------------------ void songThree::draw() { cout << "Drawing songThree screen" << endl; drawGrid(); ofDrawBitmapString("SONG THREE", ofGetWidth()/2, ofGetHeight()/2 + 20); string sceneName = ""; switch(mgr.getCurScene()) { case SONG_THREE_FIRST: ofEnableAlphaBlending(); sceneName = "First Sub Scene!"; ofSetColor(255, 255, 255); //homeScreen.draw (0,0); ofDisableAlphaBlending(); break; } }
//------------------------------------------------------------------ void callScene::draw() { cout << "Drawing home screen" << endl; drawGrid(); string sceneName = ""; switch(mgr.getCurScene()) { case CALL_SCENE_FIRST: ofEnableAlphaBlending(); sceneName = "First Sub Scene!"; ofSetColor(255, 255, 255); callScreen.draw (0,0); ofDisableAlphaBlending(); break; } }
// once again, this is based on the Microsoft sample above static void drawOpacitySlider(struct colorDialog *c, ID2D1RenderTarget *rt) { D2D1_SIZE_F size; D2D1_RECT_F rect; D2D1_GRADIENT_STOP stops[2]; ID2D1GradientStopCollection *collection; D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES lprop; D2D1_BRUSH_PROPERTIES bprop; ID2D1LinearGradientBrush *brush; double hypot; D2D1_POINT_2F center; HRESULT hr; size = realGetSize(rt); rect.left = 0; rect.top = 0; rect.right = size.width; rect.bottom = size.height * (5.0 / 6.0); // bottommost sixth for arrow drawGrid(rt, &rect); stops[0].position = 0.0; stops[0].color.r = 0.0; stops[0].color.g = 0.0; stops[0].color.b = 0.0; stops[0].color.a = 1.0; stops[1].position = 1.0; stops[1].color.r = 1.0; // this is the XAML color Transparent, as in the source stops[1].color.g = 1.0; stops[1].color.b = 1.0; stops[1].color.a = 0.0; hr = rt->CreateGradientStopCollection(stops, 2, // note that in this case this gamma is explicitly specified by the original D2D1_GAMMA_2_2, D2D1_EXTEND_MODE_CLAMP, &collection); if (hr != S_OK) logHRESULT(L"error creating stop collection for opacity slider gradient", hr); ZeroMemory(&lprop, sizeof (D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES)); lprop.startPoint.x = 0; lprop.startPoint.y = (rect.bottom - rect.top) / 2; lprop.endPoint.x = size.width; lprop.endPoint.y = (rect.bottom - rect.top) / 2; ZeroMemory(&bprop, sizeof (D2D1_BRUSH_PROPERTIES)); bprop.opacity = 1.0; bprop.transform._11 = 1; bprop.transform._22 = 1; hr = rt->CreateLinearGradientBrush(&lprop, &bprop, collection, &brush); if (hr != S_OK) logHRESULT(L"error creating gradient brush for opacity slider", hr); rt->FillRectangle(&rect, brush); brush->Release(); collection->Release(); // now draw a black arrow center.x = (1 - c->a) * size.width; center.y = size.height; hypot = size.height - rect.bottom; drawArrow(rt, center, hypot); }
void Tableur::paintEvent(QPaintEvent *event) { clearImage(); drawGrid(); QPainter painter(this); painter.drawImage(QPoint(0,0),m_image); }
//------------------------------------------------------------------ void homeScene::draw() { ofEnableAlphaBlending(); drawGrid(); string sceneName = ""; switch(mgr.getCurScene()) { case MNH_HOME_SCENE_FIRST: sceneName = "First Sub Scene!"; ofSetColor(255, 255, 255); homeScreen1.draw(0,0); break; case MNH_HOME_SCENE_SECOND: sceneName = "Second Sub Scene!"; ofSetColor(255, 255, 255); homeScreen2.draw(0,0); break; } ofDisableAlphaBlending(); // button.draw(); }
/************************************************************* Create the geometry **************************************************************/ void MakeGeometry(void) { int i; double radius = 0.5; static double theta = 0; GLfloat mshin1[] = {5.0}; /* For the sphere */ GLfloat mspec1[] = {0.5,0.5,0.5,1.0}; GLfloat mdiff1[] = {0.6,0.0,0.6,1.0}; GLfloat mamb1[] = {0.1,0.0,0.1,1.0}; GLfloat mdiff2[] = {0.0,1.0,0.0,1.0}; /* Green plane */ GLfloat mamb2[] = {0.0,0.2,0.0,1.0}; drawAxises(500, 2.0); drawGrayBox(200); drawGrid(1000); drawSomething(); // yellow square drawSomething2(); // small purple square drawSomething3(); // two chads near the origin drawBresenhamCircle(); // drawDetector(); }
/** * Draws the entities. * This function can only be called from within the paint event * */ void RS_GraphicView::drawLayer1(RS_Painter *painter) { // drawing paper border: if (isPrintPreview()) { drawPaper(painter); } // drawing meta grid: if (!isPrintPreview()) { //increase grid point size on for DPI>96 int dpiX = qApp->desktop()->logicalDpiX(); // DEBUG_HEADER // RS_DEBUG->print(RS_Debug::D_ERROR, "dpiX=%d\n",dpiX); const RS_Pen penSaved=painter->getPen(); if(dpiX>96) { RS_Pen pen=penSaved; pen.setWidth(RS2::Width01); painter->setPen(pen); } //only drawGrid updates the grid layout (updatePointArray()) drawMetaGrid(painter); //draw grid after metaGrid to avoid overwriting grid points by metaGrid lines //bug# 3430258 drawGrid(painter); if(dpiX>96) painter->setPen(penSaved); } }
void xQGanttBarViewPort::update(int x1, int y1, int x2, int y2) ////////////////////////////////////////////////////////// { QPainter p(this); // QTime time1 = QTime::currentTime(); if(_drawGrid) drawGrid(&p, x1, y1, x2, y2); // QTime time2 = QTime::currentTime(); // printf("%d msec for drawing grid.\n", time1.msecsTo( time2 ) ); // drawContents(&p, x1, y1, x2, y2); drawItem(_toplevelitem, &p, QRect(x1, y1, x2 - x1, y2 - y1)); // time1 = QTime::currentTime(); // printf("%d msec for drawing contents.\n", time2.msecsTo( time1 ) ); if(_drawHeader) drawHeader(&p, x1, y1, x2, y2); // time2 = QTime::currentTime();< // printf("%d msec for drawing header.\n", time1.msecsTo( time2 ) ); }