Visual Illusion (2)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.