Docsity

Setfillstyle, Lecture notes of Computer Graphics

Toggle sidebar
bg1
Home | Forum | About Us
Google Search
Search
Home HTML CSS JavaScript Graphics in C PHP ASP.NET Android C# VB Script JQuery SQLite Practical Books Daily Dose Volumes
Learn C GRAPHICS
Introduction
Let's Start
Functions
arc()
bar()
bar3d()
circle()
cleardevice()
closegraph()
drawpoly()
ellipse()
fillellipse()
fillpoly()
floodfill()
getbkcolor()
getcolor()
getdrivername()
getimage()
getmaxcolor()
getmaxx()
getmaxy()
getpixel()
getx()
gety()
grapherrormsg()
graphresult()
imagesize()
line()
linerel()
lineto()
moverel()
moveto()
outtext()
outtextxy()
pieslice()
Previous Chapter Next
Chapter
Definition
setfillstyle()function sets the current fill pattern and fill color.
Declaration
void setfillstyle( int pattern, int color);
setfillstyle() function contains two arguments pattern and color. Various fill
patterns are already enumerated in graphics.h header file as given below:
enum fill_styles
{
EMPTY_FILL,
SOLID_FILL,
LINE_FILL,
LTSLASH_FILL,
SLASH_FILL,
BKSLASH_FILL,
LTBKSLASH_FILL,
HATCH_FILL,
XHATCH_FILL,
INTERLEAVE_FILL,
WIDE_DOT_FILL,
CLOSE_DOT_FILL,
USER_FILL
};
There are various colors that are also mentioned in graphics.h header file
and the possible color values are from 0 - 15 BLACK(0), BLUE(1), GREEN(2),
CYAN(3), RED(4), MAGENTA(5), BROWN(6), LIGHTGRAY(7), DARKGRAY(8),
LIGHTBLUE(9), LIGHTGREEN(10), LIGHTCYAN(11), LIGHTRED(12),
LIGHTMAGENTA(13), YELLOW(14), WHITE(15).
Program
#include<stdio.h>
#include<graphics.h>
#include<conio.h>
void main()
{
int gd=DETECT, gm,bkcolor;
initgraph(&gd,&gm," ");
setfillstyle(EMPTY_FILL,YELLOW);
bar3d(2,150,100,200,25,1);
setfillstyle(SOLID_FILL,RED);
Document & Manage APIs
Make your APIs easier to consume Produce doc & SDKs, secure access
pf2

Partial preview of the text

Download Setfillstyle and more Lecture notes Computer Graphics in PDF only on Docsity!

Home | Forum | About Us

Google Search Search

Home HTML CSS JavaScript Graphics in C PHP ASP.NET Android C# VB Script JQuery SQLite Practical Books Daily Dose Volumes

Learn C GRAPHICS

Introduction Let's Start Functions arc() bar() bar3d() circle() cleardevice() closegraph() drawpoly() ellipse() fillellipse() fillpoly() floodfill() getbkcolor() getcolor() getdrivername() getimage() getmaxcolor() getmaxx() getmaxy() getpixel() getx() gety() grapherrormsg() graphresult() imagesize() line() linerel() lineto() moverel() moveto() outtext() outtextxy() pieslice()

Previous Chapter (^) ChapterNext

Definition

setfillstyle() function sets the current fill pattern and fill color.

Declaration

void setfillstyle( int pattern, int color);

setfillstyle() function contains two arguments pattern and color. Various fill patterns are already enumerated in graphics.h header file as given below:

enum fill_styles { EMPTY_FILL, SOLID_FILL, LINE_FILL, LTSLASH_FILL, SLASH_FILL, BKSLASH_FILL, LTBKSLASH_FILL, HATCH_FILL, XHATCH_FILL, INTERLEAVE_FILL, WIDE_DOT_FILL, CLOSE_DOT_FILL, USER_FILL };

There are various colors that are also mentioned in graphics.h header file and the possible color values are from 0 - 15 BLACK(0), BLUE(1), GREEN(2), CYAN(3), RED(4), MAGENTA(5), BROWN(6), LIGHTGRAY(7), DARKGRAY(8), LIGHTBLUE(9), LIGHTGREEN(10), LIGHTCYAN(11), LIGHTRED(12), LIGHTMAGENTA(13), YELLOW(14), WHITE(15).

Program

#include<stdio.h> #include<graphics.h> #include<conio.h> void main() { int gd=DETECT, gm,bkcolor;

initgraph(&gd,&gm," "); setfillstyle(EMPTY_FILL,YELLOW); bar3d(2,150,100,200,25,1); setfillstyle(SOLID_FILL,RED);

Document & Manage APIs

Make your APIs easier to consume Produce doc & SDKs, secure access

WebTutorials

HTML

CSS

JavaScript JQuery VB Script

Programming

C

C++

C

Graphics in C

Legal

Privacy Policy Terms and Conditions Terms of Service Terms of Use

Contact and Support

About www.eitworld.com [email protected]

Copyright (c) 2014 EIT World

putimage()

rectangle()

sector()

setbkcolor()

setcolor()

setfillstyle()

setlinestyle()

settextstyle()

setviewport()

textheight()

textwidth()

Previous Chapter (^) ChapterNext

bar3d(150,150,250,200,25,1); setfillstyle(LINE_FILL,BLUE); bar3d(300,150,400,200,25,1); setfillstyle(LTSLASH_FILL,GREEN); bar3d(450,150,550,200,25,1); setfillstyle(SLASH_FILL,CYAN); bar3d(2,250,100,300,25,1); setfillstyle(BKSLASH_FILL,BROWN); bar3d(150,250,250,300,25,1); setfillstyle(LTBKSLASH_FILL,MAGENTA); bar3d(300,250,400,300,25,1); setfillstyle(HATCH_FILL,LIGHTRED); bar3d(450,250,550,300,25,1); setfillstyle(XHATCH_FILL,DARKGRAY); bar3d(2,350,100,400,25,1); setfillstyle(INTERLEAVE_FILL,YELLOW); bar3d(150,350,250,400,25,1); setfillstyle(WIDE_DOT_FILL,LIGHTMAGENTA); bar3d(300,350,400,400,25,1); setfillstyle(CLOSE_DOT_FILL,LIGHTGRAY); bar3d(450,350,550,400,25,1); getch(); closegraph(); }

The above program will display various filled rectangular bar at different- different positions with different fill patterns and fill colors. These fill patters and fill colors are set by the setfillstyle() function. The output of the above program is given below:

Output