コード例 #1
0
void CInspectorTreeCtrl::OnPaint()
{   
    CPaintDC dc(this); 

    CPropertyInspector * parent = static_cast <CPropertyInspector *> (GetParent());

    CRect rcClip;
    dc.GetClipBox( &rcClip );       
    rcClip.right = getColumnWidth(0);

    CRgn rgn;                   
    rgn.CreateRectRgnIndirect( &rcClip );
    dc.SelectClipRgn(&rgn);

    CWnd::DefWindowProc(WM_PAINT, reinterpret_cast <WPARAM> (dc.m_hDC), 0);     // let CTreeCtrl paint as normal
    rgn.DeleteObject();

    rcClip.right += parent->getColumnWidth(1);
    rgn.CreateRectRgnIndirect( &rcClip );
    dc.SelectClipRgn(&rgn);

    drawValues(dc);

    rgn.DeleteObject();
}
コード例 #2
0
long
GUIParameterTracker::GUIParameterTrackerPanel::onPaint(FXObject*,
        FXSelector,void*) {
    if (!isEnabled()) {
        return 1;
    }
    if (makeCurrent()) {
        myWidthInPixels = getWidth();
        myHeightInPixels = getHeight();
        if (myWidthInPixels!=0&&myHeightInPixels!=0) {
            glViewport(0, 0, myWidthInPixels-1, myHeightInPixels-1);
            glClearColor(1.0, 1.0, 1.0, 1);
            glDisable(GL_DEPTH_TEST);
            glDisable(GL_LIGHTING);
            glDisable(GL_LINE_SMOOTH);
            glEnable(GL_BLEND);
            glEnable(GL_ALPHA_TEST);
            glDisable(GL_COLOR_MATERIAL);
            glLineWidth(1);
            glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
            // draw
            glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
            drawValues();
            glFlush();
            swapBuffers();
        }
        makeNonCurrent();
    }
    return 1;
}
コード例 #3
0
ファイル: grid.cpp プロジェクト: Allenjonesing/tutorials
// Draws the grid to the specified location and device context with
// (x_pos,y_pos) representing the upper-left hand corner of where to draw from
// If the path finding has been completed, drawGrid() also draws the path
// from the start CCell to the destination CCell
void CGrid::draw(HDC dest_dc, int x_pos, int y_pos)
{
	// Debug error checking
	assert(dest_dc != NULL);

	// First draw the values of the grid squares
	drawValues(dest_dc,x_pos,y_pos);

	HPEN hpen;
	HPEN old_pen;

	// Create a "red pen" to draw the grid with
	hpen = CreatePen(PS_SOLID,2,RGB(255,10,10));

	// Select into the destination device context
	old_pen = (HPEN)SelectObject(dest_dc,hpen);

	int grid_wid = getWidth(); // Get the total grid width in pixels
	int grid_hgt = getHeight(); // Get the total grid height in pixels

	// Draw the vertical lines
	for(int x = x_pos; x <= (grid_wid + x_pos); x += CCell::width)
	{
		MoveToEx(dest_dc,x,y_pos,NULL);
		LineTo(dest_dc,x,y_pos + grid_hgt);
	}

	// Draw the horizontal lines
	for(int y = y_pos; y <= (grid_hgt + y_pos); y += CCell::height)
	{
		MoveToEx(dest_dc,x_pos,y,NULL);
		LineTo(dest_dc,x_pos + grid_wid,y);
	}

	// Put back the original pen
	SelectObject(dest_dc,old_pen);
	DeleteObject(hpen); // Delete the HPEN we made

	// If we found the destination -- Draw the path as well
	if(dest_found)
	{
		drawPath(dest_dc,x_pos,y_pos);
		Sleep(200);
			return;
	}
}
コード例 #4
0
ファイル: System.cpp プロジェクト: imclab/Lines
void System::draw(){   
    
    ofSetColor(0,0,0);
    ofRect(0, 0, ofGetWidth(), ofGetHeight());
    switch(drawMode){
        case VALUES:
            drawValues();            
            break;
        case TEMPO:
            drawTempo();
            break;
        case WAVES: 
            drawWaves();
            break;
    }
    
}
コード例 #5
0
ファイル: Diagram.cpp プロジェクト: kuhmuckl/kuhmuckl
QGraphicsPixmapItem* Diagram::draw(QString title){
    if(pixmap == 0)
        return 0;
    QPainter p(pixmap);
    p.setPen(QPen(Qt::white));
    p.setBrush(Qt::white);
    p.drawRect(pixmap->rect());

    calculateAxisSteps();

    drawCaption(p, title);
    drawXAxis(p);
    drawYAxis(p);
    drawValues(p);
    drawHorizontalLines(p);

    return new QGraphicsPixmapItem(*pixmap,0,scene);
}
コード例 #6
0
/*
 *  display()
 *  ------
 *  Display the scene
 */
void display()
{
  glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
  glEnable(GL_DEPTH_TEST);
  glLoadIdentity();

  /* setup functions */
  setEye();

  /* draw */
  drawAxes();
  drawValues();

  /* magic here */
  drawShape();

  glFlush();
  glutSwapBuffers();
}
コード例 #7
0
ファイル: puzzleprinter.cpp プロジェクト: KDE/ksudoku
void PuzzlePrinter::print (const ksudoku::Game & game)
{
    const ksudoku::Puzzle * puzzle = game.puzzle();
    const SKGraph *         graph  = puzzle->graph();
    if (graph->sizeZ() > 1) {
        KMessageBox::information (m_parent,
            i18n("Sorry, cannot print three-dimensional puzzles."));
        return;
    }
    const int leastCellsToFit = 20;	// Avoids huge cells in small puzzles.

    // Set up a QPrinter and a QPainter and allocate space on the page.
    bool pageFilled = setupOutputDevices (leastCellsToFit, graph->sizeX());
    if (! m_printer) {
	return;				// The user did not select a printer.
    }

    // Draw the puzzle grid and its contents.
    bool hasBlocks   = (graph->specificType() != Mathdoku);
    bool hasCages    = ((graph->specificType() == Mathdoku) ||
	                (graph->specificType() == KillerSudoku));
    bool killerStyle = (graph->specificType() == KillerSudoku);

    if (hasBlocks) {			// Only Mathdoku has no blocks.
	drawBlocks (puzzle, graph);
    }
    if (hasCages) {			// Mathdoku and KillerSudoku have cages.
	drawCages (puzzle, graph, killerStyle);	// KillerSudoku has blocks too.
    }
    drawValues (game, graph);		// Print starting and filled-in values.

    if (pageFilled) {
        endPrint();			// Print immediately.
    }
    else {
        KMessageBox::information (m_parent,
            i18n ("The KSudoku setting for printing several puzzles per page "
                  "is currently selected.\n\n"
                  "Your puzzle will be printed when no more will fit on the "
                  "page or when KSudoku terminates."));
    }
}
コード例 #8
0
/*
 *  display()
 *  ------
 *  Display the scene
 */
void display()
{
  glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
  glEnable(GL_DEPTH_TEST);
  glLoadIdentity();

  /* setup functions */
  setEye();

  /* draw */
  drawAxes();
  drawValues();

  /* magic here */
  /*
  cube(1,0,1, 1,1,1, 0);
  cube(-1,0,1, 1,1,1, 0);
  cone(0,1,0, 1,1,DEF_D);
  cone(0,-1,0, 1,1,90);
  */

  /* a 'tower' */
  /*
  cube(0,1.5,0, 1,3,1, 0);
  cube(0,3.5,0, 2,1,2, 45);
  spike(0,1,-3.5, 0.5,1, 90, 90,0,0);
  spike(0,1,3.5, 0.5,1, 90, -90,0,0);
  spike(-3.5,1,0, 0.5,1, 90, 0,0,-90);
  spike(3.5,1,0, 0.5,1, 90, 0,0,90);
  */
  tower(0,0,0, 1,1,1, 0);
  tower(4,0,0, 1,1,1.5, 30);

  glFlush();
  glutSwapBuffers();
}
コード例 #9
0
ファイル: StartScene.cpp プロジェクト: Turgure/Simulation_3D
void StartScene::draw(){
	DrawGraph(0, 0, bg, true);
	drawValues(menus[order.size()-1], (order.size() == 1));
}