Smile emoji using graphics



#include<graphics.h>

void BoundaryFill_4_Connected(int,int,int,int);
using namespace std;
main()
{
   int gd = DETECT, gm;
   char path[] ="";
   initgraph(&gd, &gm, path);
   circle(200,200,100);
   circle(240,160,13);
   circle(160,160,13);
   ellipse(200, 250, 0, 360, 25, 10);
   BoundaryFill_4_Connected( 200, 200, YELLOW, WHITE);
   BoundaryFill_4_Connected( 240, 160, CYAN, WHITE);
   BoundaryFill_4_Connected( 160, 160, CYAN, WHITE);
   BoundaryFill_4_Connected( 200, 250, RED, WHITE);
   getch();
   closegraph();
   return 0;
}

void BoundaryFill_4_Connected(int x,int y,int f_color,int b_color)
{
    int current = getpixel(x,y);
    if(current != b_color && current != f_color)
    {
        putpixel(x,y,f_color);
        BoundaryFill_4_Connected( x+1, y, f_color, b_color);
        BoundaryFill_4_Connected( x-1, y, f_color, b_color);
        BoundaryFill_4_Connected( x, y+1, f_color, b_color);
        BoundaryFill_4_Connected( x, y-1, f_color, b_color);
    }
}


OUTPUT:


Comments

  1. provide soft copy of program after 7 in computer graphics

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete

Post a Comment

Popular posts from this blog

HOW TO SETUP CODE BLOCKS FOR GRAPHICS PROGRAMS

Smile emoji using graphics in Java using Applet