This document provides information about graphics functions in C. It begins by explaining graphics modes and how images are displayed on screens using pixels. It then provides details on the initgraph() function which initializes the graphics system. The rest of the document summarizes many common graphics functions like line(), rectangle(), circle(), putpixel(), getpixel() and more, explaining what they do and their parameters.
Transformation:
Transformations are a fundamental part of the computer graphics. Transformations are the movement of the object in Cartesian plane.
Types of transformation
Why we use transformation
3D Transformation
3D Translation
3D Rotation
3D Scaling
3D Reflection
3D Shearing
Transformation:
Transformations are a fundamental part of the computer graphics. Transformations are the movement of the object in Cartesian plane.
Types of transformation
Why we use transformation
3D Transformation
3D Translation
3D Rotation
3D Scaling
3D Reflection
3D Shearing
This slide contain description about the line, circle and ellipse drawing algorithm in computer graphics. It also deals with the filled area primitive.
In JavaScript, almost "everything" is an object.
-Booleans can be objects (if defined with the new keyword)
-Numbers can be objects (if defined with the new keyword)
-Strings can be objects (if defined with the new keyword)
-Dates are always objects
-Maths are always objects
-Regular expressions are always objects
-Arrays are always objects
-Functions are always objects
-Objects are always objects
For all who wish to learn c graphics programming, no knowledge of graphics concepts is required. C Graphics programming is very easy and interesting. You can use graphics programming for developing your own games, in making projects, for animation etc. It's not like traditional C programming in which you have to apply complex logic in your program and then you end up with a lot of errors and warnings in your program. In C graphics programming you have to use standard library functions ( need not worry if you don't know functions ) to get your task done. Just you pass arguments to the functions and it's done. On this website you will find almost all functions with detailed explanation and a sample program showing the usage of a function. To make things easy you are provided with executable files which you can download and execute. Firstly you should know the function initgraph which is used to initialize the graphics mode . To initialize graphics mode we use initgraph function in our program. initgraph function is present in "graphics.h" header file, so your every graphics program should include "graphics.h" header file. We will discuss initgraph withe help of following sample program:-
This slide contain description about the line, circle and ellipse drawing algorithm in computer graphics. It also deals with the filled area primitive.
In JavaScript, almost "everything" is an object.
-Booleans can be objects (if defined with the new keyword)
-Numbers can be objects (if defined with the new keyword)
-Strings can be objects (if defined with the new keyword)
-Dates are always objects
-Maths are always objects
-Regular expressions are always objects
-Arrays are always objects
-Functions are always objects
-Objects are always objects
For all who wish to learn c graphics programming, no knowledge of graphics concepts is required. C Graphics programming is very easy and interesting. You can use graphics programming for developing your own games, in making projects, for animation etc. It's not like traditional C programming in which you have to apply complex logic in your program and then you end up with a lot of errors and warnings in your program. In C graphics programming you have to use standard library functions ( need not worry if you don't know functions ) to get your task done. Just you pass arguments to the functions and it's done. On this website you will find almost all functions with detailed explanation and a sample program showing the usage of a function. To make things easy you are provided with executable files which you can download and execute. Firstly you should know the function initgraph which is used to initialize the graphics mode . To initialize graphics mode we use initgraph function in our program. initgraph function is present in "graphics.h" header file, so your every graphics program should include "graphics.h" header file. We will discuss initgraph withe help of following sample program:-
Computer graphics are graphics created using computers and the representation of image data by a computer specifically with help from specialized graphic hardware and software.
The interaction and understanding of computers and interpretation of data has been made easier because of computer graphics. Computer graphic development has had a significant impact on many types of media and have revolutionized animation, movies and the video game industry.
This presentation covers very frequently used standard library functions also called as inbuilt functions. a brief description about function and its declaration (syntax) is defined for help.
Presentation on C++ Programming Languagesatvirsandhu9
It consists information about c++ programming language which is a object oriented language. This presentation is very useful for those who want to learn c++ from beginning.
This file contains all the practicals with output regarding GTU syllabus. so it will help to IT and Computer engineering students. It is really knowledgeable so refer these for computer graphics practicals.
This ppt's introduced Basics of computer graphics, which helps to diploma in computer engineering, DCA BCA, BE computer science student's to improve study in computer graphics.
Lecture 4 from the COSC 426 graduate class on Augmented Reality. Taught by Mark Billinghurst from the HIT Lab NZ at the University of Canterbury. August 1st 2012
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
By Design, not by Accident - Agile Venture Bolzano 2024
C Graphics Functions
1. Graphics Under C/IITM/Shakoor Ab-2012 Page 1
Graphics under C
Graphics modes
Graphics mode is a way of displaying images on a computer screen or other
graphics device such that the basic unit is the pixel. Lines and characters
on the screen are drawn pixel by pixel. The resolution and complexity of the
image depends on how many pixels there are in total, and how many bits are
assigned to each pixel. The more bits per pixel, the more different colors
or shades of gray. A single graphics device can operate in a number of
different graphics modes with different resolutions and color selections. A
common mode for a desktop PC would be 1024 by 768 pixels with 256 different
colors – chosen from a much larger number – available for each pixel.
Many video adapters support several different modes of resolution, all of
which are divided into two general categories: character mode and graphics
mode.
Of the two modes, graphics mode is the more sophisticated. Programs that
run in graphics mode can display an unlimited variety of shapes and fonts,
whereas programs running in character mode are severely limited. Programs
that run entirely in graphics mode are called graphics-based programs.
In character mode, the display screen is treated as an array of blocks, each
of which can hold one ASCII character. In graphics mode, the display screen
is treated as an array of pixels. Characters and other shapes are formed by
turning on combinations of pixels.
2. Graphics Under C/IITM/Shakoor Ab-2012 Page 2
initgraph():Initialize the Graphics System
#include <graphics.h>
void far initgraph(gdriver,gmode,dpath);
int far *gdriver; /* graphics driver */
int far *gmode; /* graphics mode */
char far *dpath; /* directory path of driver*/
initgraph() is a graphics system control function. It is used to
initialize the graphics system. It should be the first graphics
function called. initgraph() loads the graphics driver, after
allocating memory for it, then puts the system in graphics mode.
initgraph() can be used in either of two ways: 'gdriver' must be set
to one of the constants:
CONSTANT NUMERIC VALUE
DETECT 0
CGA 1
MCGA 2
EGA 3
EGA64 4
EGAMONO 5
IBM8514 6
HERCMONO 7
ATT400 8
VGA 9
PC3270 10
If 'gdriver' is set to DETECT (autodetection), it calls detectgraph()
and automatically selects the highest resolution graphics mode for
'gmode'. To override this selection, 'gdriver' can be set to one of
the other 10 constants in the above chart. 'gmode' can then be set
to one of the following constants (defined in <graphics.h>):
GRAPHICS
DRIVER GRAPHICS_MODES VALUE RES PALETTE PAGES
CGA CGAC0 0 320x200 C0 1
CGAC1 1 320x200 C1 1
CGAC2 2 320x200 C2 1
CGAC3 3 320x200 C3 1
CGAHI 4 640x200 2 color 1
MCGA MCGAC0 0 320x200 C0 1
MCGAC1 1 320x200 C1 1
MCGAC2 2 320x200 C2 1
MCGAC3 3 320x200 C3 1
MCGAMED 4 640x200 2 color 1
MCGAHI 5 640x480 2 color 1
EGA EGALO 0 640x200 16 color 4
EGAHI 1 640x350 16 color 2
EGA64 EGA64LO 0 640x200 16 color 1
EGA64HI 1 640x350 4 color 1
3. Graphics Under C/IITM/Shakoor Ab-2012 Page 3
EGAMONO EGAMONOHI 3 640x350 2 color 1*
EGAMONOHI 3 640x350 2 color 4**
HERCMONO HERCMONOHI 0 720x348 2 color 2
ATT400 ATT400C0 0 320x200 C0 1
ATT400C1 1 320x200 C1 1
ATT400C2 2 320x200 C2 1
ATT400C3 3 320x200 C3 1
ATT400MED 4 640x200 2 color 1
ATT400HI 5 640x400 2 color 1
VGA VGALO 0 640x200 16 color 4
VGAMED 1 640x350 16 color 2
VGAHI 2 640x480 16 color 1
PC3270 PC3270HI 0 720x350 2 color 1
IBM8514 IBM8514HI 0 640x480 256 colors
IBM8514LO 1 1024x768 256 colors
*64K EGAMONO card
**256K EGAMONO card
'dpath' names the directory path where the graphic driver files are
located. If they are not found in 'dpath' or 'dpath' is NULL, the
current directory is searched.
When initgraph() is called, all graphic settings (current position,
palette, color, etc) are reset to their defaults. graphresult()
(which returns graphic error code) is reset to 0.
Returns: Nothing. initgraph() always sets the internal error code.
On success, graphresult() returns 0. On error,
graphresult() (and 'gdriver') returns:
-2 Cannot find a graphics card
-3 Cannot find a driver file
-4 Invalid driver
-5 Insufficient memory to load driver
Notes: closegraph() should be called to shut down the graphics
system. A call to closegraph() restores the screen to
the mode it was in before initgraph() was called.
Overview of Graphics System
There are many new graphics functions in C. They are all in the
library, GRAPHICS.LIB. These functions allow you to control the
graphics system, manipulate screens and viewports, output text to the
graphics screen, draw and fill shapes, control the background and
foreground color, handle graphics errors and inquire into the state of
the graphics system.
In order to use these graphics functions, you must
4. Graphics Under C/IITM/Shakoor Ab-2012 Page 4
(1) include <graphics.h> in your program,
(2) initialize the graphics system and put it in the
graphics mode,
(3) shut down the graphics system.
Therefore, programs using graphics functions should have the
following as a basic framework:
#include <graphics.h>
main()
{
int graphdriver = DETECT, graphmode;
initgraph();
/* graphics functions */
closegraph();
}
arc():Draw a Circular Arc
#include <graphics.h>
void far arc(x,y,start,end,rad);
int x;
int y;
int start, end;
int rad;
arc() draws the outline of an arc in the current drawing color. The
circular arc is centered at 'x','y' with a radius of 'rad'. The arc
travels from 'start' to 'end.
bar():Draw and Fills a Bar
#include <graphics.h>
void far bar(l,t,r,b);
int l;
int t;
int r;
int b;
bar() draws and fills in a rectangular bar. The bar is drawn using
the upper left coordinates ('l','t') and the lower right coordinates
('r','b'). The current fill pattern and fill color is used to fill
in the bar. The bar is not outlined.
bar3d():Draw and Fills a 3-Dimensional Bar
#include <graphics.h>
5. Graphics Under C/IITM/Shakoor Ab-2012 Page 5
void far bar3d(l,t,r,b,depth,tflag);
int l;
int t;
int r;
int b;
int depth;
int tflag;
bar3d() draws and fills in a three-dimensional rectangular bar. The
bar is drawn using the upper left coordinates ('l','t') and the lower
right coordinates ('r','b'). The current fill pattern and fill color
is used to fill in the bar. The bar is outlined using the current
line style and color. 'depth' determines the bar's depth. 'tflag'
not equal to zero signals that a three-dimensional top is to be put
on the bar.
circle():Draw a Circle
#include <graphics.h>
voidfar circle(x,y,rad);
int x;
int y;
int rad;
circle() draws a circle. Its center is at coordinates ('x','y') and
its radius is 'rad'.
cleardevice():Clear the Graphics Screen
#include <graphics.h>
void far cleardevice(void);
cleardevice() erases the entire graphics screen and moves the current
position (CP) to home position which is the upper left hand corner of
the screen with coordinates (0,0). All other graphics system
settings, such as the viewport settings, the line settings, the style
settings, etc., remain the same.
clearviewport():Erase the Current Viewport
#include <graphics.h>
void far clearviewport(void);
clearviewport() clears the current viewport. The current position
(CP) is returned to home position (0,0).
closegraph():Shut Down the Graphics System
#include <graphics.h>
6. Graphics Under C/IITM/Shakoor Ab-2012 Page 6
void far closegraph(void);
closegraph() shuts down the graphics system by deallocating all the
memory that was allocated by initgraph(). The screen is restored to
the mode it was in before initgraph() was called. closegraph() is a
graphics system control function and should be the last graphics
function called.
drawpoly():Draw a Polygon
#include <graphics.h>
void far drawpoly(npoint,ppoints);
int npoint;
int far *ppoints;
drawpoly() draws a polygon with 'npoint' points. 'ppoints' points to
a sequence of pairs of integers. Each pair of integers represents the
('x','y') coordinates of 'npoint'.
There should be twice as many 'ppoints' as 'npoint'. You must always
'close' the polygon you are drawing, by repeating the first
coordinates given. (A triangle, with three points, should have four
sets of coordinates, the fourth being the same as the first.) The
polygon is drawn using the current line style and color.
ellipse():Draw an Elliptical Arc
#include <graphics.h>
void far ellipse(x,y,start,end,xrad,yrad);
int x, y;
int start, end;
int xrad, yrad;
ellipse() draws an elliptical arc. ('x','y') are the coordinates of
its center. 'xrad' is the horizontal axis and 'yrad' is the vertical
axis. The ellipse is drawn from 'start' to 'end'. (To draw a
complete ellipse, 'start' = 0 and 'end' = 360.)
fillellipse():Draw and Fill and Ellipse
#include <graphics.h>
void far fillellipse(x, y, xrad, yrad);
int x, y; Center point
int xrad; Horizontal radius
int yrad; Vertical radius
This function draws and fills an ellipse with center point at
(x, y), horizontal radius xrad, and vertical radius yrad. The
current fill color is used.
7. Graphics Under C/IITM/Shakoor Ab-2012 Page 7
floodfill():Fill a Bounded Region
#include <graphics.h>
void far floodfill(x,y,border);
int x;
int y;
int border;
floodfill() fills figures drawn using arc(), circle(), ellipse(),
drawpoly(), line(), lineto(), linerel() and rectangle(). The bounded
area is filled with the current fill pattern and fill color. The
coordinates ('x','y') represent a point within the area to be
flooded. If the point is within an enclosed area, the area inside
the border will be filled. If the point is outside an enclosed area,
the area outside the border will be filled.
getbkcolor():Get the Current Background Color
#include <graphics.h>
int far getbkcolor(void);
getbkcolor() returns the current background color which can be one of
the following values defined in <graphics.h>
getcolor():Get the Current Drawing Color
#include <graphics.h>
int far getcolor(void);
getcolor() returns the current drawing color. The value returned is
actually an index into the palette which contains the exact color
information. Pixels on the screen are set to this value when lines
or figures are drawn.
getgraphmode():Get the Current Graphics Mode
#include <graphics.h>
int far getgraphmode(void);
getgraphmode() returns the current graphics mode set by a previously
successful call to initgraph() or setgraphmode(). With the current
graphics mode stored in a temporary variable, the system can be set
to various graphics modes supported by the driver, or to text mode,
and then restored via setgraphmode().
getmaxcolor():Get the Maximum Color Value for Current
Mode
#include <graphics.h>
8. Graphics Under C/IITM/Shakoor Ab-2012 Page 8
int far getmaxcolor(void);
getmaxcolor() returns the highest valid pixel value for the current
graphics driver and mode. A pixel value is an index into a color
table called a 'palette'. The range of pixel values (0 - (size-1))
is determined by the size of the palette.
getmaxx():Get the Current x Resolution
#include <graphics.h>
int far getmaxx(void);
getmaxx() returns the maximum x screen coordinate for the current
graphics mode. This function is very useful for positioning text and
graphics on the screen.
getmaxy():Get the Current y Resolution
#include <graphics.h>
int far getmaxy(void);
getmaxy() returns the maximum y screen coordinate for the current
graphics mode. This function is very useful for positioning text and
graphics on the screen.
getdrivername():Get Current Graphics Driver Name
#include <graphics.h>
char *far getdrivername(void);
The getdrivername() function returns a pointer to a string
holding the name of the current graphics driver.
Returns: A far pointer to a string which identifies the
current driver.
getmodename():Return Mode Name for Specified Driver
#include <graphics.h>
char * far getmodename(mode_num);
int mode_num; Mode you want information about
The getmodename() function returns a pointer to a string which
contains the name of the indicated graphics mode, as specified
by mode_num.
getpixel():Get the Color of the Given Pixel
9. Graphics Under C/IITM/Shakoor Ab-2012 Page 9
#include <graphics.h>
unsigned far getpixel(x,y);
int x;
int y;
getpixel() gets the color of the pixel specified by coordinates
('x','y').
Returns: The color of the specified pixel.
line():Draw a Line
#include <graphics.h>
void far line(x1,y1,x2,y2);
int x1,y1;
int x2,y2;
line() draws a line between two specified points, ('x1','y1'), and
('x2','y2'). The line is drawn in the current color, line style and
thickness. The current position (CP) in not affected by a call to
this function.
outtextxy():Output a String to Screen at Specified
Position
#include <graphics.h>
void far outtextxy(x,y,tstring);
int x;
int y;
char far *tstring;
outtextxy() outputs graphics text at the specified position ('x','y')
relative to the current viewport. The text is output using the
current text font, text direction, character size and text
justification settings. (See settextstyle() and settextjustify() for
more information regarding these text attributes.)
pieslice():Draw a Pieslice
#include <graphics.h>
void far pieslice(x,y,stangle,endangle,radius);
int x;
int y;
int stangle, endangle;
int radius;
pieslice() draws a pieslice shape with the center at ('x','y') and
with a radius 'radius'. The slice starts at 'stangle' and goes
counterclockwise toward 'endangle'. 0 degrees is at 3 o'clock and 90
degrees is at 12 o'clock.
10. Graphics Under C/IITM/Shakoor Ab-2012 Page 10
putpixel():Plot a Pixel at Specified Coordinates
#include <graphics.h>
void putpixel(x,y,pcolor);
int x;
int y;
int pcolor;
putpixel() draws a pixel at the specified coordinates ('x','y'). The
pixel is displayed in the color 'pcolor'.
rectangle():Draw a Rectangle
#include <graphics.h>
void far rectangle(l,t,r,b);
int l;
int t;
int r;
int b;
rectangle() draws a rectangle at the given coordinates, 'l' left, 't'
top, 'r' right, and 'b' bottom. The rectangle is drawn using the
current color, line style and thickness.
sector():Draw an Elliptical Sector
#include <graphics.h>
void far sector(x, y, stangle, endangle, xradius, yradius);
int x, y; Center point
int stangle, Starting angle
int endangle; Ending angle
int xradius; Horizontal radius
int yradius; Vertical radius
This function is the same as pieslice, except that it draws an
elliptical pie slice. The center point is at (x, y), stangle
and endangle are the starting and ending angles, the
horizontal radius is xradius, and the vertical radius is
yradius.
setbkcolor():Set the Background Color
#include <graphics.h>
void far setbkcolor(color);
int color;
setbkcolor() sets the current background color which can be one of
the following values defined in <graphics.h>:
Value Name
11. Graphics Under C/IITM/Shakoor Ab-2012 Page 11
0 BLACK
1 BLUE
2 GREEN
3 CYAN
4 RED
5 MAGENTA
6 BROWN
7 LIGHTGRAY
8 DARKGRAY
9 LIGHTBLUE
10 LIGHTGREEN
11 LIGHTCYAN
12 LIGHTRED
13 LIGHTMAGENTA
14 YELLOW
15 WHITE
setcolor():Set the Current Drawing Color
#include <graphics.h>
void far setcolor(color);
int color;
setcolor() sets the current drawing color to 'color', which
represents an index into the palette. The range of values 'color'
can have is determined by the size of the palette. getmaxcolor() will
return the highest possible color value, which is (size-1).
Therefore, the range of possible color values is 0 to (size-1).
setfillstyle():Set the Fill Pattern and Fill Color
#include <graphics.h>
void far setfillstyle(pattern,color);
int pattern;
int color;
setfillstyle() sets the current fill pattern and fill color used by
bar(), bar3d(), fillpoly(), floodfill() and pieslice(). There are 11
predefined fill patterns. In addition you can fill a shape in with
the background color or a user-defined pattern. The names for the
predefined patterns are found in 'fill_patterns' in <graphics.h>:
Name Value Description
EMPTY_FILL 0 Fill with background color
SOLID_FILL 1 Solid fill
LINE_FILL 2 Fill with horizontal lines
LTSLASH_FILL 3 Fill with ///, regular lines
SLASH_FILL 4 Fill with ///, thick lines
BKSLASH_FILL 5 Fill with , thick lines
LTBKSLASH_FILL 6 Fill with , regular lines
HATCH_FILL 7 Fill with hatch fill
XHATCH_FILL 8 Fill with heavy hatch fill
INTERLEAVE_FILL 9 Interleaving line fill
WIDE_DOT_FILL 10 Widely spaced dot fill
CLOSE_DOT_FILL 11 Closely spaced dot fill
12. Graphics Under C/IITM/Shakoor Ab-2012 Page 12
USER_FILL 12 User-defined fill pattern
All patterns except EMPTY_FILL use the current fill color.
settextstyle():Set Current Text Font, Direction and
Size
#include <graphics.h>
void far settextstyle(font,dir,charsize);
int font;
int dir;
int charsize;
settextstyle() sets the current text font, direction and character
size. All calls to outtext() and outtextxy() are affected by the new
settings.
The graphics library includes an 8x8 bit-mapped font, in which each
character is defined by a matrix of pixels, and several stroked
fonts, in which each character is defined by a series of vectors
which determine how that character is drawn.
'font' can be an 8x8 bit-mapped font or one of several "stroked"
fonts available. The different types of fonts available are defined
in the enumeration 'font_names', defined in <graphics.h> as:
Name Value Description
DEFAULT_FONT 0 8x8 bit_mapped font
TRIPLEX_FONT 1 Stroked triplex font
SMALL_FONT 2 Stroked small font
SANS_SERIF_FONT 3 Stroked sans-serif font
GOTHIC_FONT 4 Stroked gothic font
The 8x8 bit-mapped font is the default font and is always available.
The stroked fonts are kept in separate .CHR files on disk and can be
loaded at run time or converted to .OBJ files (with the BGIOBJ
utility) and linked to your .EXE files. (See registerbgifont().)
'dir' can be either horizontal text (left to right) or vertical text
(rotated 90 degrees counterclockwise). The values for 'dir' are
defined in <graphics.h> as:
Name Value Description
HORIZ_DIR 0 Left to right
VERT_DIR 1 Bottom to top
The default direction is HORIZ_DIR.
'charsize' allows each character to be magnified by a specific
factor. If 'charsize' has a value of 0, the stroked font is magnified
using the default character magnification factor of 4, or the user-
defined character size set using setusercharsize(). If 'charsize'
has a value greater than 0, the 8x8 bit-mapped or stroked font is
13. Graphics Under C/IITM/Shakoor Ab-2012 Page 13
magnified by that factor. (For example, if 'charsize' is 1, an 8x8
bit-mapped font is displayed in an 8x8 pixel rectangle. If
'charsize' is 2, an 8x8 bit-mapped font is displayed in a 16x16 pixel
rectangle, etc.)
settextstyle() affects all subsequent calls to outtext() and
outtextxy().
setviewport():Set the Current Graphics Viewport
#include <graphics.h>
void far setviewport(left,top,right,bottom,clflag);
int left;
int top;
int right;
int bottom;
int clflag;
setviewport() defines a rectangular viewport, a "virtual screen", on
the screen. The viewport's position is defined in terms of absolute
screen coordinates, ('left','top'), ('right','bottom'). All
subsequent graphics output is written to this viewport. If 'clflag'
is set to a non-zero value, all drawings will be clipped or truncated
at its boundaries. initgraph() and setgraphmode() can be used to
reset the viewport to the entire screen.