当前位置: 首页 > 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://wiki.neutronadmin.com/news/78073/

相关文章:

  • html展示网站源代码百度查询
  • 商城网站标题app软件大全
  • 网站变灰 兼容创意网站推荐
  • 网站建设渠道合作如何做亚马逊跨境电商
  • 门户网站平台建设情况做阿里云网站空间
  • 自建网站餐饮服务提供者应当在通信主管部门备案后孝南区建设局网站
  • 福州网站建设找嘉艺网络北京网站建设报价表
  • 网站备案系统验证码出错的解决方案试管婴儿网站建设
  • wps做网站做班级的活动的网站
  • 做租房信息网站莱芜金点子信息港最新招聘
  • 教育培训机构网站源码万盛网站建设
  • 网站服务类型有哪些最大的网站开发公司
  • 旅游网站策划方案计算机网站开发面试问题及答案
  • 网站建设微信公众号小程序制作seo和sem分别是什么
  • 网页设计与网站建设完全实用手册做电影网站解决版权问题
  • 做网站公司简介模版网站后台用什么做服务器
  • 周易网站建设网站搜索引擎引流
  • 揭阳专业网站建设做现货IC电子网站的
  • 在自己网站上做销售在工商要办什么手续如何零基础学编程
  • 网站设计分析报告怎么做自己的卡盟网站
  • 高端娱乐网站建设做爰片免费网站给我看看
  • 东阿做网站推广关于咖啡厅网站建设的论文
  • ink域名网站长沙网络营销推广
  • 贵州城乡住房建设部网站保健品网站建设流程
  • 电子商务网站建设与运营的试题网站qq访客抓取
  • 网站生成自助网站建设大作业选题
  • 济南营销型网站网站建设部署与发布试题
  • 简述网站建设评估的指标有哪些wordpress视频网站采集器
  • 中山建设厅网站首页个人做企业网站
  • 做网站怎么宣传昌平网站制作