Reprint please indicate address: http://www.cnblogs.com/wangmengmeng/
:
Source:
1#include <graphics.h>2#include <conio.h>3 4 //Defining Constants5 #defineUNIT 246 #defineOFFSET_X 1167 #defineOffset_y 368 9 //painting decorative PaintingTen voidDraawuint (intXintYintshape) One { A //Set Color - intN= ((shape&1)?1:0) + ((shape&2)?1:0) + ((shape&4)?1:0); -Setlinecolor ((n%2==1)?0xaa00cc: white); the - //Painting Branches -Line (x5, y,x+5, y); -Line (x,y-5, x,y+5); + - //painting leaves +Rectangle (x1, Y4, x+1, Y2); ARectangle (x1, y+2, x+1, y+4); atRectangle (x4, Y1, X-2, y+1); -Rectangle (x+2, Y1, x+4, y+1); - } - voidMain () - { - //create a drawing form inInitgraph (640,480); - //Set white background to SetBkColor (white); + Cleardevice (); - //set the origin of coordinates the Setorigin (offset_x,offset_y); * intx, y; $ Panax Notoginseng //picture lattice background - for(y=0;y< -; y++) the for(x=0;x< -; x + +){ +Setfillcolor (((x+y)%2)?0x83be3e:0X01DCAA); ASolidrectangle (X*unit,y*unit, (x+1) *unit-1, (y+1) *unit-1); the } + - //Painting decoration Flowers $ for(y=0;y< -; y++){ $ intShape=8-y%8; - for(x=0;x< -; x + +) -Draawuint ((x+1) *unit, (y+1) *unit,shape++); the } - Wuyi //Press any key to exit the getch (); - closegraph; Wu}
From: C language Programming Classic 236 Cases
Visual Illusion (2)