示例#1
0
int main(int argc, char** argv)
{
	img.load("img/4.pgm");
	//img.filterSobel();
	
    initLines(&linesq);
	showLines(&linesq);
	calcRectangles(&linesq, &recsq);
	calcTriangles(&linesq, &triangles);
	showRectangles(&recsq);
	showTriangles(&triangles);
	
	 
	glutInit( &argc, argv );
	glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);
	glutInitWindowSize(1000, 700);
	glutInitWindowPosition(100, 100);
	glutCreateWindow( "Cam" );
	glutDisplayFunc(display);
	//glutMouseFunc(mouseButton); 
	glutKeyboardFunc(keyboard);
	//glutReshapeFunc(resize); 
	initialize(); //init OpenGL state
	glutMainLoop();

    return 0;
}
示例#2
0
void showArea(predefinedArea area, char *description)
{
  GLCD.ClearScreen(); 
  GLCD.DrawBitmap(icon, 0,  0); 
  GLCD.DrawBitmap(icon, 64, 0); 
  textArea.DefineArea(area);
  textArea.SelectFont(System5x7);
  textArea.SetFontColor(WHITE); 
  textArea.ClearArea(); 
  textArea.println(description);
  textArea.print("text area");
  delay(1000);
  textArea.SetFontColor(WHITE); 
  textArea.ClearArea();
  showLines(10);
  delay(1000);   
  textArea.ClearArea();
  textArea.SetFontColor(BLACK);   
  showLines(10);
  delay(1000); 
}
void ofxGridSystem::buildGrid(float iPageWidth, float iPageHeight, int iNumColumns, float iBaselineLeading, float iLeft, float iRight, float iHead, float iTail)
{
    width = iPageWidth;
    height = iPageHeight;
    
    numCol = iNumColumns;
    
    //Left, right, bottom, top in grid terms.
    left = iLeft;
    right = iRight;
    tail = iTail;
    head = iHead;
    
    leading = iBaselineLeading;
    
    
    //Back size determines position of left margin line.
    leftX = iLeft;
    //Gutter size determines position of left margin line.
    rightX = width - iRight;
    //Head determines top margin location.
    topY = height - head;
    //Tail determines bottom margin location.
    bottomY = tail;
    
    //Determine column width, Swiss grid style.
    //There is a baselineLeading space between each column. 
    colW = (width - left - right - (numCol-1)*leading)/(float)numCol;
    
    //Calculate baseline grid positions. 
    //NOTE Baseline grid starts at top of page. So you are responsible for aligning grid with head and tail.
    numBaselines = (int)(height/(float)leading);
    baselines = new float[numBaselines];
    for(int i=0; i < numBaselines; i++)
        baselines[i] = topY - (float)i*leading;
    
    isGridShown = false;
    isBaselineGridShown = false;
    
    buildLines();
    //By default, start with lines hidden.
    showLines(false);
}