graphics_lab2
graphics_lab2
#include <graphics.h>
#include <iostream>
int main() {
outtext("This is outtext()");
getch();
closegraph();
return 0;
}
9) Color Functions
#include <graphics.h>
#include <iostream>
int main() {
setbkcolor(BLUE);
cleardevice();
setcolor(YELLOW);
int bg = getbkcolor();
cout << "Current background color code: " << bg << endl;
int fg = getcolor();
cout << "Current text color code: " << fg << endl;
getch();
closegraph();
return 0;
}
10(a) 2D Translation
#include <graphics.h>
#include <iostream>
int main() {
x1 += tx; y1 += ty;
x2 += tx; y2 += ty;
getch();
closegraph();
return 0;
}
10(b) 2D Rotation
#include <graphics.h>
#include <iostream>
#include <math.h>
int main() {
getch();
closegraph();
return 0;
}
10(c) 2D Scaling
#include <graphics.h>
#include <iostream>
int main() {
int sx = 2, sy = 2;
getch();
closegraph();
return 0;
}
11) Cohen-Sutherland Clipping (Basic Demo)
#include <graphics.h>
#include <iostream>
int main() {
getch();
closegraph();
return 0;
}
12) Midpoint Subdivision Clipping (Basic Demo)
#include <graphics.h>
#include <iostream>
int main() {
getch();
closegraph();
return 0;
}
13) Bezier Curve
#include <graphics.h>
#include <iostream>
#include <math.h>
int main() {
getch();
closegraph();
return 0;
}
14(a) Car Drawing
#include <graphics.h>
#include <iostream>
int main() {
getch();
closegraph();
return 0;
}
14(b) Man Drawing
#include <graphics.h>
#include <iostream>
int main() {
getch();
closegraph();
return 0;
}
15) Car Animation
#include <graphics.h>
#include <iostream>
#include <dos.h>
int main() {
cleardevice();
delay(30);
getch();
closegraph();
return 0;