[C] 选择用户定义的填充模式 →→→→→进入此内容的聊天室

来自 , 2020-10-25, 写在 C, 查看 173 次.
URL http://www.code666.cn/view/2b45c629
  1. #include <graphics.h>
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. #include <conio.h>
  5.  
  6. int main(void)
  7. {
  8.    /* request auto detection */
  9.    int gdriver = DETECT, gmode, errorcode;
  10.    int maxx, maxy;
  11.  
  12.    /* a user defined fill pattern */
  13.    char pattern[8] = {0x00, 0x70, 0x20, 0x27, 0x24, 0x24, 0x07, 0x00};
  14.  
  15.    /* initialize graphics and local variables */
  16.    initgraph(&gdriver, &gmode, "");
  17.  
  18.    /* read result of initialization */
  19.    errorcode = graphresult();
  20.    if (errorcode != grOk)  /* an error occurred */
  21.    {
  22.       printf("Graphics error: %s\n", grapherrormsg(errorcode));
  23.       printf("Press any key to halt:");
  24.       getch();
  25.       exit(1); /* terminate with an error code */
  26.    }
  27.  
  28.    maxx = getmaxx();
  29.    maxy = getmaxy();
  30.    setcolor(getmaxcolor());
  31.  
  32.    /* select a user defined fill pattern */
  33.    setfillpattern(pattern, getmaxcolor());
  34.  
  35.    /* fill the screen with the pattern */
  36.    bar(0, 0, maxx, maxy);
  37.  
  38.    /* clean up */
  39.    getch();
  40.    closegraph();
  41.    return 0;
  42. }

回复 "选择用户定义的填充模式"

这儿你可以回复上面这条便签

captcha