Graphics
Department Laser & Optoelectronics Engineering
C++ Lab.
NINE WEEK
Graphics
getmaxx and getmaxy
Declaration:
int far getmaxx(void);
int far getmaxy(void);
Remarks:
getmaxx returns the maximum x value (screen-relative) for the current
graphics driver and mode.
getmaxy returns the maximum y value (screen-relative) for the current
graphicsdriver and mode.
getx, gety
Declaration:
int far getx(void);
int far gety(void);
Remarks:
getx returns the x-coordinate of the current graphics position.
gety returns the y-coordinate of the current graphics position.
moverel, moveto
Declaration:
void far moverel(int dx, int dy);
void far moveto(int x, int y);
Remarks:
moverel moves the current position (CP)dx pixels in the x direction and dy
pixels in the y direction.
moveto moves the current position (CP) to viewport position (x, y).
getpixel, putpixel
Declaration:
unsigned
void far
Remarks:
getpixel
putpixel
far getpixel(int x, int y);
putpixel(int x, int y, int color);
gets the color of the pixel located at (x,y).
plots a point in the color defined by color at(x,y).
line, linerel, lineto
Declaration:
void far line(int x1, int y1, int x2, int y2);
void far linerel(int dx, int dy);
void far lineto(int x, int y);
Remarks:
line draws a line from (x1, y1) to (x2, y2) using the current color, line
style, and thickness. It does not update the current position (CP).
linerel draws a line from the CP to a point that is a relative distance(dx,
dy) from the CP, then advances the CP by (dx, dy).
lineto draws a line from the CP to (x, y), then moves the CP to (x, y).
arc, circle, pieslice
Declaration:
void far arc(int x, int y, int stangle, int endangle, int radius);
void far circle(int x, int y, int radius);
void far pieslice(int x, int y, int stangle, int endangle, int radius);
Remarks:
arc draws a circulararc in the current drawing color.
circle draws a circle in the current drawing color.
pieslice draws a pie slice in the current drawing color, then fills it using
the current fill pattern and fill color.
Argument
(x,y)
stangle
endangle
radius
:
:
:
:
:
What It Is/Does
Center point of arc, circlew, or pie slice
Start angle in degrees
End angle in degrees
Radius of arc,circle, and pieslice
The arc or slice travels from stangle to endangle.
If stangle = 0 and endangle = 360, the call to arc draws a complete circle.
If your circles are not perfectly round, use set aspect ratio to adjust the
aspect ratio.
Angle for arc, circle, and pieslice (counter-clockwise)
90
degrees
180
degrees
0 degrees,
360 degrees
270
degrees
The linestyle parameter doesnot affect arcs, circles, ellipses, or pie
slices. Only the thickness parameter is used.
rectangle
Declaration:
void far rectangle(int left, int top, int right, int bottom);
Remarks:
rectangle draws a rectangle in the current line style, thickness, and drawing
color.
(left,top) is the upper left corner of the rectangle, and (right,bottom) is its
lower right corner.
ellipse,fillellipse, sector
Declaration:
void far ellipse(int x, int y, int stangle, int endangle, int xradius, int
yradius);
void far fillellipse(int x, int y,int xradius, int yradius);
void far sector(int x, int y, int stangle, int endangle,int xradius, int
yradius);
Remarks:
ellipse draws an elliptical arc in the current drawing color.
fillellipse draws an ellipse, then fills the ellipsewith the current fill
color and fill pattern.
sector draws and fills an elliptical pie slice in the current drawing color,
then fills it using the pattern and color defined by setfillstyle or
setfillpattern.
Argument :
(x,y)
xradius
yradius
stangle
What It Is
: Center of ellipse
: Horizontal axis
: Vertical axis
: Starting angle
endangle : Ending angle
The ellipse or sector...
Regístrate para leer el documento completo.