Exemplo n.º 1
0
 virtual void onDrawContent(SkCanvas* canvas) {
     SkScalar width = this->width() / 3;
     drawTest(canvas, width, this->height(), SK_ColorBLACK, SK_ColorWHITE);
     canvas->translate(width, 0);
     drawTest(canvas, width, this->height(), SK_ColorWHITE, SK_ColorBLACK);
     canvas->translate(width, 0);
     drawTest(canvas, width, this->height()/2, SK_ColorGRAY, SK_ColorWHITE);
     canvas->translate(0, this->height()/2);
     drawTest(canvas, width, this->height()/2, SK_ColorGRAY, SK_ColorBLACK);
 }
Exemplo n.º 2
0
static void drawTestGL(Ihandle* ih)
{
  Ihandle* glcanvas = IupGetAttributeHandle(ih, "PREVIEWGLCANVAS");
  if (glcanvas)
  {
    int w = IupGetInt(ih, "PREVIEWWIDTH");
    int h = IupGetInt(ih, "PREVIEWHEIGHT");

    IupGLMakeCurrent(glcanvas);
    glViewport(0,0,w,h);

    glClearColor(1.0, 0.0, 1.0, 1.f);  /* pink */
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glColor3f(1.0,0.0,0.0);  /* red */
    glBegin(GL_QUADS); 
    glVertex2f(0.9f,0.9f); 
    glVertex2f(0.9f,-0.9f); 
    glVertex2f(-0.9f,-0.9f); 
    glVertex2f(-0.9f,0.9f); 
    glEnd();

    IupGLSwapBuffers(glcanvas);
  }
  else
    drawTest(ih);
}
Exemplo n.º 3
0
static int file_cb(Ihandle* ih, const char* filename, const char* status)
{
    (void)ih;
    printf("FILE_CB(%s - %s)\n", status, filename);

    if (strcmp(status, "PAINT")==0)
    {
        printf("  SIZE(%s x %s)\n", IupGetAttribute(ih, "PREVIEWWIDTH"), IupGetAttribute(ih, "PREVIEWHEIGHT"));
#ifdef USE_CD
        drawTestCD(ih);
#else
#ifdef USE_OPENGL
        drawTestGL(ih);
#else
        drawTest(ih);
#endif
#endif
    }
    else if (strcmp(status, "FILTER")==0)
    {
        //IupSetAttribute(ih, "FILE", "test");
        //return IUP_CONTINUE;
    }

    return IUP_DEFAULT;
}
Exemplo n.º 4
0
int main(void)
{
  LCD_init();
  
  while(1) {    
    drawTest(0); //simple text    
    drawTest(1); //simple drawing
    drawTest(2); //more simple drawing
    drawTest(6); //simple progress bar
    drawTest(3); //scrolling text up-down
    drawTest(4); //menus with invert
    drawTest(5); //reading status of LCD
    drawTest(7); //128x64 bmp on screen   
    drawTest(8); //put a bmp on screen (atmel picture is 108x35)    
    drawTest(9);
  }  
  return 0;
}
Exemplo n.º 5
0
static int action(Ihandle *ih, float posx, float posy)
{
  printf("ACTION(posx=%.2f, posy=%.2f)\n", posx, posy);
  drawTest(ih, (int)posx);
  return IUP_DEFAULT;
}
Exemplo n.º 6
0
void CBoxProxyView::OnDraw(CDC* /*pDC*/)
{
	CBoxProxyDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if (!pDoc)
		return;

	// TODO: 在此处为本机数据添加绘制代码
	// 清除颜色
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	glPushMatrix();
	{
		// 绘制坐标系

		if (gettingDepth)
			glVertexAttrib4d(ColorPos,0.0,1.0,0.0,0.0);


		if(!gettingDepth){
			drawUnitAxes();
			drawTest();
			
			if (showOrig)
			{
				glColor3f(0,1,0);
				for (int i=0;i<boxes.size();i++)
					drawBoxLines(boxes.at(i));
			}

			if (showExtend)
			{
				glColor3f(0,1,1);
				for (int i=0;i<extendedBoxes.size();i++)
					drawBoxLines(extendedBoxes.at(i));
			}
			
		}
		else if(testMode){
			for (int i=0;i<boxes.size();i++)
				drawBoxPolygons(boxes.at(i));
		}
		else{
			for (int i=0;i<boxes.size();i++)
				drawBoxPolygons(boxes.at(i));
		}
			


	}
	glPopMatrix();
	// 交换缓冲区
	if (gettingDepth)
	{
		GetDepthAfter();
	}
	else
		SwapBuffers(wglGetCurrentDC());


}
Exemplo n.º 7
0
//--------------------------------------------------------------
void testApp::draw(){
	
	ofEnableBlendMode(OF_BLENDMODE_ALPHA);
	if(outputMode == 0){
		ofBackground(0);
	}else if(outputMode == 1){
		
		glPushMatrix();
		glTranslatef(ofGetScreenWidth()/2 - screenWidth/2, 0, 0);
		drawTest();
		glPopMatrix();
		
	}else if(outputMode == 2){
		ofBackground(0);
		glPushMatrix();
		glTranslatef(ofGetScreenWidth()/2 - screenWidth/2, 0, 0);
		drawRaw();
		glPopMatrix();
		
	}else if(outputMode == 3){
		ofBackground(0);
		glPushMatrix();
		glTranslatef(ofGetScreenWidth()/2 - screenWidth/2, 0, 0);
		drawBlurred();
		glPopMatrix();
		
	}else if(outputMode == 4 || outputMode == 5){
		
		ofBackground(0);
		fbo_tex.begin();
		ofClear(0, 0, 0, 255);
		glPushMatrix();
		
		if(outputMode == 4){
			drawBlurred();
		}else{
			drawTest();
		}
		
		//drawRaw();
		glPopMatrix();
		fbo_tex.end();
	
		ofPixels pixels;
		fbo_tex.readToPixels(pixels);
		map_tex.loadData(pixels);
		
		ofBackground(0);
		ofSetColor(255,255,255,255);
		//bind and draw texture
		//glEnable(GL_DEPTH_TEST);  
		glPushMatrix();
		glTranslatef(ofGetScreenWidth()/2 - screenWidth/2, 0, 0);
		
		map_tex.bind();
		glBegin(GL_QUADS);
		
		for(int y = 0; y < gridSize - 1; y++){
			for(int x = 0; x < gridSize - 1; x++){
				
				int i = x + (gridSize * y);
				glTexCoord2f(t_points[i].x,t_points[i].y); 
				glVertex2i(v_points[i].x, v_points[i].y); // top left 
				
				i += 1;
				glTexCoord2f(t_points[i].x,t_points[i].y); 
				glVertex2i(v_points[i].x, v_points[i].y); // top right 
				
				i += gridSize;
				glTexCoord2f(t_points[i].x,t_points[i].y); 
				glVertex2i(v_points[i].x, v_points[i].y); // bottom right 
				
				i -= 1;
				glTexCoord2f(t_points[i].x,t_points[i].y); 
				glVertex2i(v_points[i].x, v_points[i].y); // bottom left 
				
				
			}
		}
		
		glEnd();
		
		map_tex.unbind();
		
		glPopMatrix();
		//glDisable(GL_DEPTH_TEST); 
	
	}else if(outputMode == 6){
		
		
		
		ofBackground(255);
		glPushMatrix();
		glTranslatef(ofGetScreenWidth()/2 - screenWidth/2, 0, 0);
		
		//sp.draw(0, 0, screenWidth,screenHeight);
		
		ofBackground(255);
		fbo_tex.begin();
		ofClear(0, 0, 0, 255);
		glPushMatrix();
		
			drawTest();
		
		
		//drawRaw();
		glPopMatrix();
		fbo_tex.end();
		
		ofPixels pixels;
		fbo_tex.readToPixels(pixels);
		map_tex.loadData(pixels);
		
		ofSetColor(255,255,255,255);
		//bind and draw texture
		//glEnable(GL_DEPTH_TEST);  
		glPushMatrix();
		glTranslatef(ofGetScreenWidth()/2 - screenWidth/2, 0, 0);
		
		map_tex.bind();
		glBegin(GL_QUADS);
		
		for(int y = 0; y < gridSize - 1; y++){
			for(int x = 0; x < gridSize - 1; x++){
				
				int i = x + (gridSize * y);
				glTexCoord2f(t_points[i].x,t_points[i].y); 
				glVertex2i(v_points[i].x, v_points[i].y); // top left 
				
				i += 1;
				glTexCoord2f(t_points[i].x,t_points[i].y); 
				glVertex2i(v_points[i].x, v_points[i].y); // top right 
				
				i += gridSize;
				glTexCoord2f(t_points[i].x,t_points[i].y); 
				glVertex2i(v_points[i].x, v_points[i].y); // bottom right 
				
				i -= 1;
				glTexCoord2f(t_points[i].x,t_points[i].y); 
				glVertex2i(v_points[i].x, v_points[i].y); // bottom left 
				
				
			}
		}
		
		glEnd();
		
		map_tex.unbind();
		
		
		//draw image + quad points
		for(int i = 0; i < v_points.size() - 1; i++){
			(i == selPoint ) ? ofSetColor(255, 0, 0):ofSetColor(0,255,0);
			ofCircle(v_points[i].x , v_points[i].y, 2);
			ofSetColor(150);
		}
		glPopMatrix();
	}
	
	ofSetColor(100, 100, 100);
	//ofDrawBitmapString(ofToString(ofGetFrameRate(),2), 20,20);
	
}