当前位置: 首页 > news >正文

建设培训网站办安全员c证网站建设丨找王科杰信誉

建设培训网站办安全员c证,网站建设丨找王科杰信誉,建设银行信用卡中心,电脑编程网站青岚影视 www.qldyy.net 在事先画好的一个区域内#xff0c;使用区域填充之种子填充线扫描法将其填充完毕。同时带有鼠标和键盘事件#xff0c;并添加了菜单。对于存在的改变窗口大小程序会出现问题还没有很好的解决#xff0c;只是仅仅将窗口大小固定住了#xff0c;不能随…青岚影视 www.qldyy.net 在事先画好的一个区域内使用区域填充之种子填充线扫描法将其填充完毕。同时带有鼠标和键盘事件并添加了菜单。对于存在的改变窗口大小程序会出现问题还没有很好的解决只是仅仅将窗口大小固定住了不能随意改变大小。不对的地方还请大家多多指正希望与大家多交流哦。 #include GL/glut.h#include stdio.h//#include conio.h//#include dos.h#include windows.h const int length 3;const int coord 2;const int num 10; int stack_top;int stack[10000];int fill 0; /* fill flag */// 长宽比受到限制就现在而言只能是宽要大于长原因有两个//一个为画点原点位置不正确另一个是围城区域的线条宽度太小int Wheight 200;int Wwidth 200;int control 0;typedef float Color[length];typedef int POI[coord];Color newColor {1.0f, 1.0f, 0};// 背景颜色Color oldColor {1.0f, 0, 0}; // 函数调用前至少要先声明或者直接定义到掉用地之前int stackPop(){ int val; val stack[stack_top]; stack_top stack_top-1; return val; } void stackPush(int p_xy){ stack_top 1; stack[stack_top] p_xy; } int isStackEmpty(){ if(stack_top0)  return 1; else  return 0; } void setStackEmpty(){ int i; for(i0; istack_top; i)  stack[i]0;     stack_top0; } //画点函数void setPixel(float x, float y, Color color){ glBegin(GL_POINTS); glColor3f(color[0], color[1], color[2]); glVertex2f(x, y); glEnd();} //颜色判定函数颜色相同的话返回1不相同的话则返回0int judgeColor(float x, float y, Color color){ Color tmp; int res 1; glReadPixels(x, y, 1, 1, GL_RGB, GL_FLOAT, tmp); for (int i 0; i length; i) {  if(color[i] ! tmp[i])  {   res 0;   //printf(%f,%f,x,y);  } } return res;} // 填充函数从最下侧向上填充void floodFill(int x, int y, Color newColor, Color oldColor, int dir){  int xl, xr, x0, xnextspan;    bool spanNeedFill;    //将栈清空    setStackEmpty();    //种子入栈    stackPush(x);    stackPush(y); while(isStackEmpty() ! 0)  {        //栈顶出栈注意出栈顺序        y stackPop();        x stackPop();  //printf(nihao1);        setPixel(x, y, newColor);        x0 x1;  while(judgeColor(x0,y,oldColor) 1) //向右填充  {   //printf(nihao2);   setPixel(x0,y,newColor);   x0;  }  xr x0-1; //最右元素  x0 x-1; //恢复到起始元素   while(judgeColor(x0,y,oldColor) 1) //向左填充  {   setPixel(x0, y, newColor);   x0--;  }  xlx01; //最左元素  //处理下面一条扫描线  x0xl;  yydir;  if (isStackEmpty() 0)  {  }  // 从最左到最右均无oldColor元素将不再压栈  while (x0xr)  {    spanNeedFillFALSE;      while (judgeColor(x0,y,oldColor) 1)   {     if (spanNeedFillFALSE)      spanNeedFillTRUE;    x0;   }   // 将元素压栈   if(spanNeedFill)   {        if (x0xr)    {      stackPush(x0);     stackPush(y);    }    else    {     stackPush(x0-1);     stackPush(y);    }    spanNeedFillFALSE;   }    xnextspanx0;   // 立即跳出循环   while(judgeColor(x0,y,oldColor)!1 x0xr) x0;   // 如果是最边上的   if (xnextspanx0)     x0;  } } } void drawLine(){ glBegin(GL_LINE_LOOP); glVertex2i(130, 130); glVertex2i(60, 130); glVertex2i(60, 10); glVertex2i(130, 10); glEnd(); glFlush();} // 界面刷新void refresh(){ glClearColor(1.0, 0.0, 0.0, 0.0);  glClear(GL_COLOR_BUFFER_BIT); glFlush(); drawLine();} void myDisplay(void){  glClearColor(1.0, 0.0, 0.0, 0.0);  glClear(GL_COLOR_BUFFER_BIT); // 单色方式 glShadeModel(GL_FLAT);      // 设置点的大小    //glPointSize(100.0f); // 设置视口 //glViewport(1.0f, 1.0f, 600, 400); glOrtho(-0.5f, Wwidth, -0.5f, Wheight, -200, 200); // 设置点的颜色 glColor3f(0.0, 1.0f, 0.0f); glLineWidth(2);    //glBegin(GL_POINTS); // 绘制“点”的原点是在窗口正中间 drawLine(); //glPopAttrib();} // 鼠标左键事件void mouse(int btn, int state, int x, int y){ // x,y为窗口左上角为原点的鼠标位置 if(btnGLUT_LEFT_BUTTON stateGLUT_DOWN) {  floodFill(x, Wheight-y, newColor, oldColor, 1);  floodFill(x, Wheight-y, newColor, oldColor, -1);  printf(开始填充);  //printf(%d,\t%d,x,y); }} // 鼠标右键事件void right_menu(int id){ if(id 2) exit(0); else if (id 0) {  floodFill(61, 129, newColor, oldColor, -1);  printf(开始绘制); } else{ // myDisplay();  refresh(); }}// 键盘事件void keyboard(unsigned char key, int x, int y){ switch (key) { case 27:  // Esc键退出  exit(0);  break; default:  break;    }} /*//换算比例void changeSize(int w, int h) {  // 防止除数即高度为0 // (你可以设置窗口宽度为0). if(h 0)  h 1;  float ratio 1.0* w / h;  // 单位化投影矩阵。 glMatrixMode(GL_PROJECTION); glLoadIdentity();  // 设置视口大小为增个窗口大小 glViewport(0, 0, w, h);  // 设置正确的投影矩阵 gluPerspective(45,ratio,1,1000); //下面是设置模型视图矩阵 glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(0.0,0.0,5.0, 0.0,0.0,-1.0,0.0f,1.0f,0.0f);}*/   void main(){ int f_menu; int gMainHandle; glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);    glutInitWindowSize(Wwidth, Wheight);    glutInitWindowPosition(100, 150);     gMainHandle glutCreateWindow(Seed Fill);      glutSetWindow(gMainHandle);      HWND hwnd FindWindow(NULL,Seed Fill);      if( hwnd )      {           LONG style;           style GetWindowLong(hwnd,GWL_STYLE);           style ~WS_THICKFRAME;           SetWindowLong(hwnd,GWL_STYLE,style);      }  f_menu glutCreateMenu(right_menu); glutAddMenuEntry(开始,0); glutAddMenuEntry(清空,1); glutAddMenuEntry(退出,2); glutAttachMenu(GLUT_RIGHT_BUTTON);  glutMouseFunc(mouse); glutKeyboardFunc(keyboard);    glutDisplayFunc(myDisplay); //换算比例 //glutReshapeFunc(NULL); glutMainLoop();}转载于:https://www.cnblogs.com/yxfcnbg/archive/2012/11/15/2772502.html
http://www.yutouwan.com/news/78073/

相关文章:

  • 国内知名企业网站线上销售技巧
  • 网站开发设计课程教案html个人网页完整代码展示
  • 溧阳网站开发wordpress手机版如何设置
  • 设计网站费用多少wordpress 页面挂件
  • 广州和信建设公司网站网站建设工资高吗
  • 企业电子商务网站公司做网站域名归谁
  • wordpress指定目录为首页台州百度关键词优化
  • 吉林省城乡住房建设厅网站温州网站制作价格
  • iis网站连接数据库失败怎么自己做网页初学者
  • 做网站用地图渭南房产网站制作
  • 重庆免费注册推广网站连云港建设局电力网站
  • 合肥建站比较便宜的公司简单广告设计软件
  • 北京网站设计公司兴田德润放心wordpress 翻译失效
  • 金华规划局网站开发区钙网logo设计免费
  • 建网站需要营业执照吗如何制作局域网站
  • 网上哪个网站做的系统好用吗山东网站建设和游戏开发的公司
  • 网站模板 jsp十佳网站
  • 文化网站建设需要的功能做网站赚钱平台
  • 网站做跳转影响排名吗360建筑网如何修改名字
  • 百度新闻源网站有哪些淘宝网站建设的主要工作
  • 网站核验点佛山搜索引擎推广服务好
  • 企业网站推广的方法有哪些专业类搜题软件
  • 建网站软件最新恶意网站怎么办
  • 网址查询网站名称淘宝建设网站的目的是什么意思
  • 怎么做打赏看视频的网站搜索引擎排名优化
  • 网站建设的技术体会西安网站建设系统开发
  • 开发网站的工具有哪些重庆排名seo公司
  • 俄语在线网站建设做网站功能需要注意什么
  • 盐城那里做网站好点微信企业公众号开发平台
  • 简约风格的网站二维码图片制作