示例#1
0
文件: line.c 项目: S010/test
void
Draw(void)
{
	const int	 side = 80;
	Figure		*square;
	Figure		*square_t;

	square = AllocFigure(4);
	square->v[0] = (Vertex){ 0, 0 };
	square->v[1] = (Vertex){ 0, side };
	square->v[2] = (Vertex){ side, side };
	square->v[3] = (Vertex){ side, 0 };
	DrawFigure(square);

	square_t = DupFigure(square);
	RotateFigure(square_t, PI / 6.0);
	DrawFigure(square_t);

	CopyFigure(square_t, square);
	RotateFigure(square_t, PI / 5.0);
	DrawFigure(square_t);

	CopyFigure(square_t, square);
	RotateFigure(square_t, PI / 4.0);
	DrawFigure(square_t);
}
MRESULT EXPENTRY ClientWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
     {
     static INT  cxClient, cyClient ;
     static LONG alJoin [] = { LINEJOIN_BEVEL, LINEJOIN_ROUND, LINEJOIN_MITRE },
                 alEnd  [] = { LINEEND_FLAT, LINEEND_SQUARE, LINEEND_ROUND } ;
     HPS         hps ;
     INT         i ;

     switch (msg)
	  {
          case WM_SIZE:
               cxClient = SHORT1FROMMP (mp2) ;
               cyClient = SHORT2FROMMP (mp2) ;
               return 0 ;

          case WM_PAINT:
               hps = WinBeginPaint (hwnd, NULLHANDLE, NULL) ;

               GpiErase (hps) ;

               for (i = 0 ; i < 3 ; i++)
                    {
                              // Draw the geometric line

                    GpiSetLineJoin (hps, alJoin [i]) ;
                    GpiSetLineEnd  (hps, alEnd  [i]) ;
                    GpiSetLineWidthGeom (hps, cxClient / 20) ;
                    GpiSetColor (hps, CLR_DARKGRAY) ;

                    GpiBeginPath (hps, 1) ;
                    DrawFigure (hps, i, cxClient, cyClient) ;
                    GpiEndPath (hps) ;

                    GpiStrokePath (hps, 1, 0) ;

                              // Draw the cosmetic line

                    GpiSetLineWidth (hps, LINEWIDTH_THICK) ;
                    GpiSetColor (hps, CLR_BLACK) ;

                    DrawFigure (hps, i, cxClient, cyClient) ;
                    }

               WinEndPaint (hps) ;
               return 0 ;
          }
     return WinDefWindowProc (hwnd, msg, mp1, mp2) ;
     }
示例#3
0
void OnPaint(HWND hwnd)
{
	DrawGLScene();
	SwapBuffers(hDC);
	DrawPicture(hwnd);
	DrawFigure();
}
示例#4
0
void DisplayScene()
{
	// kolor t³a - zawartoœæ bufora koloru
	glClearColor(1.0, 1.0, 1.0, 1.0);

	// czyszczenie bufora koloru i bufora g³êbokoœci
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	// wybór macierzy modelowania
	glMatrixMode(GL_MODELVIEW);

	// macierz modelowania = macierz jednostkowa
	glLoadIdentity();

	// przesuniêcie uk³adu wspó³rzêdnych szeœcianu do œrodka bry³y odcinania
	glTranslatef(0.0, 0.0, -(near + far) / 2);

	// obroty szeœcianu
	glRotatef(rotatex, 1.0, 0.0, 0.0);
	glRotatef(rotatey, 0.0, 1.0, 0.0);

	// niewielkie powiêkszenie szeœcianu
	glScalef(1.15, 1.15, 1.15);

	// w³¹czenie testu bufora g³êbokoœci
	glEnable(GL_DEPTH_TEST);

	// w³¹czenie efektu mg³y
	glEnable(GL_FOG);

	// wskazówki jakoœci generacji mg³y
	glHint(GL_FOG_HINT, fog_hint);

	// kolor mg³y
	glFogfv(GL_FOG_COLOR, White);

	// gêstoœæ mg³y
	glFogf(GL_FOG_DENSITY, fog_density);

	// rodzaj mg³y
	glFogf(GL_FOG_MODE, fog_mode);

	// pocz¹tek i koniec oddzia³ywania mg³y liniowej
	glFogf(GL_FOG_START, fog_start);
	glFogf(GL_FOG_END, fog_end);

	// wyœwietlenie szeœcianu
	//glCallList(CUBE_LIST);

	DrawFigure();

	// wy³¹czenie efektu mg³y
	glDisable(GL_FOG);

	// skierowanie poleceñ do wykonania
	glFlush();

	// zamiana buforów koloru
	glutSwapBuffers();
}
示例#5
0
文件: widget.cpp 项目: Naxik/Lab2
void DrawPlot(QLabel* plot, QVector<int> values)
{
    QPixmap pm(350, 510);
    QPoint Center(10, pm.height() - 20);
    QPainter painter(&pm);

    pm.fill(Qt::white);
    DrawScale(painter, Center, pm.height() - 20, pm.width() - 20);
    DrawFigure(painter, Center, values);
    painter.end();
    plot->setGeometry(200, 40, pm.width(), pm.height());
    plot->setPixmap(pm);
    plot->show();
}
示例#6
0
void	Repaint()
{
	DrawGLScene();
	SwapBuffers(hDC);
	DrawFigure();
}