Header file:
graphics.h
Synopsis:
void setactivepage(int page);
Description:
setactivepage() sets the active page for graphics output. Our graphics card can support multiple graphics page and the active page might not be the one which is visible onscreen.
setactivepage function in c graphics
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void) {
/* select a driver and mode that supports multiple pages. */
int graphicDriver = EGA, graphicMode = EGAHI;
int err, midx, midy;
/* initialize graphics and local variables */
initgraph(&graphicDriver, &graphicMode,
"C:/TURBOC3/BGI");
/* read result of initialization */
err = graphresult();
if (err != grOk) {
/* an error occurred */
printf("Graphic Error: %s\n",
grapherrormsg(err));
getch();
return 0;
}
/* mid position in x and y axis */
midx = getmaxx() / 2;
midy = getmaxy() / 2;
/* select the off screen page for drawing */
setactivepage(1);
/* output a message on page #1 */
settextjustify(CENTER_TEXT, CENTER_TEXT);
outtextxy(midx, 50, "Here is page 1");
setcolor(10);
setfillstyle(SOLID_FILL, 10);
sector(midx, midy, 0, 360, 200, 50);
getch();
/* select page #1 as the visible page */
setvisualpage(1);
/* clean up */
getch();
closegraph();
return 0;
}
Output: (setactivepage built-in function in c graphics.h)
No comments:
Post a Comment