Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
17 views
Prectical File Computer Graphics
THis is related to the computer graphics. It tell us how to run
Uploaded by
Kausar Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Prectical File Computer Graphics For Later
Download
Save
Save Prectical File Computer Graphics For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
17 views
Prectical File Computer Graphics
THis is related to the computer graphics. It tell us how to run
Uploaded by
Kausar Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Prectical File Computer Graphics For Later
Carousel Previous
Carousel Next
Save
Save Prectical File Computer Graphics For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 35
Search
Fullscreen
Experiment No. Of 0 | Aim! Psqgvam to dean 4 Line using algorithm - _ ‘Sousce Code — a —S # include
a — Ht include
4h include
# jnclude < dos. h> sroid_ main ©) 4 Beppie “DAA Float wy, XL Vt, x2 ,%2 dx, dy, steps int i, gd= DETECT, gms int gxaph C8ad egm roy" e:\\vs code\\ gi") Brace Entex -the starting point of Une"); scanf ("2pF (hf " Bx BYI) > printf (" Entes the ending point of Une") 5 - —_seanf ("ht sph", 8x2 eye); _K= a bs(xe-xs ffm dy - abs (¥2-94);jot BYA bec a dx -dx/step } oo dy = dy [steps — Xt wKbp _ — SC _Putpixel (x»¥.S)3 —$___— Mo xKX4dx - a _ + - yiytdy OC [— ist+t | _____ detay (100) > SSS gqetebUs el . a close graph) Output - Entes the tarting point of line | - 100 100 Entes the ending paint of Line _ — ton 400 . OC -int_ad= De . _—int_gd= DETECT, gm Source co. | * a - | # include
| # include Conio-h> _| FH include < gsaphics. b> ; - Void main) Une Algorithm, Dato. 39 Dec.29 Page No......O%.... Poogram 40 draw @ line usin e iq Bxesenham ‘s de BC int xy) xt XQ yiy2,dx dy, ps initgraph (Rad, &gm,") s Cleas device () + printf (" BRES@NHAM’S LINE DRAWING ALGO\n \n")s printf C'Entes initial cooretinate:") 3 seanfl "hd thd", @xI, 2Yt) y printf C'Entex final coordinate’) 5 scanfl" thd hd", 2x2,2 N2); Ax = K2-xUG oly = ¥2-¥1; p=2* dy-dx 5 x YEytsExQt NOs putpixel (% 94) } while ( x< X2) ; if (p
4 include
# include
#H Include
Votd Floed (int, int, int. int) + Sousce Code — - = 4 | Void main() * i tntad = DETECT. 9m3 oO oT intQsaph (2gd, qm.) 5 sectangle (50,50, 250,250) + Flood (55, $5, 10,0) + geteh O; 4 void Plood Gntx, ioty intfillColos, intdeault Colox ) a if (getpixel Voy) == default Coles Fes 1 = delay LO) 5 putpixel L4N> Filteolos) 5 : Plood (x+h,Y> Pilleotos , defaultColes) § - Fleed (x-4, Yo fillectos, default clos) + Flood OGYtL, Fill Colors , default Color) 3 Teacher's Signature... —Date... 4t? Dec, 22. Exot. No. Page NO. en PB unesnnnnnne Floed (x,N-1, filleolor, default Golos) 5 aa Teacher's SIGMAMUFE....sseseseernrespate... pec:2.2 EN ee Aim: Puogram to implement 4-connected boundary Fill Algorithm. Source Code - # include
bear cles) - 7 { I if (getpixel (4 y) | = Cay) t= = Fill-colos) - ——_ i Put pixel Coy, Fill-colos) } boundasy Filla (X+1, 9, Fill -colos, boundary ecley) s = boundary colos os 28 ge et pixel J boundary fill 4 (% Y+t, Fill-coloy, boundary aolos) § boundary fill4 (X-L,y, Fill—colov, boundary color): = | boundary Filla OG Y-L, Fillecolor Dowsing color) s | 4 int_main() { int_gd= DETECT, gm} Sv ” w initgraph (2gd. 29m," "') § int x2 250 , y=200, radius = S03 Teacher's Signature...Date... — ] ——— —— of . 1 Page No, 0%, eo 2 civele OGY ; vadtus) 3 boundary fill 4. O49, 6.15) > clelay Benoa) : getehO 5 Close graph C) 3 seturn © +Output ~pote. 5D se:22 imi Program to fill the polygon using Sean line_ Algorithm. Sousce Code— Ht include < Std lib ch #H Include
tH include
temp=Xi+ XL=%X2, X2 = bemmp } } if CUy2-y1)1=0) * mx (x2-x1) / Cy2-Y1) 5 else _mx = X2- *L 5 mex se = fox (isyt 3 1g 925 i++) i if (x< (float) left) Teacher's Signature...Date..5t? pec.22 PAgE NO. nnn nen, le (iJ = Cint) x: _ | if Ce > (float) xe PIT) se [iJ = (int) x: p= mas j - Noid _dsaui_ pixel (int x, int y) t - GitolosS fU1,0, 1.6, 0.0) 3 Gi Begin LGL- POINTS) ; Qgivertex 21 Ly): gitndt) > 4 _ void scanfit, (float xt, float yt, float ¥2, Ploak¥2 float ¥3, Float ys. float x4, Float y4) 2 int te [S00], xe [S00] + int t 93 fos Liza: i
400-0} X42300.03 Y4=300+0 $ gicieas (Gl-cotor.. BurFER. BIT)s gicoles3f (0.0, 0.0, 10) Q) Begin (QL.LINE. Loop): gl vertex 2F Oxy yn; qivestex 2f (X2, y2)3 gd Qlvertex OF (x3, ¥3)5 _aivertex 2s ya): End © 5 can file (Xb YL X22, X33, X49 4) 3 ql flush 0 it void myinit i _ gicleax colos (10 1:0, 460, 1-0) 3 Teacher's Signature.Gleclor sf (t-0, 0.0, 0.0) 3 Qipoint size Cho): gl matrix Mode (GL. pPRoyect ron); gl Load Identity ©) 3 qluortho 2D (0.0, 499.0, 0.0, 499-0) } ‘int main Cint-asyc, char** argv) g } i glut Init (garde argv) ; ‘glut Telia Mode CQ@LUT_ SINGLE | GLUT-REB); glut Init Window size (S00, 500); * alut Init Window Position (0,0) 3 glut Display fune (display) 3 myinit Os glut Main Loopt)} g Teacher's SIQMAtHUTe....... secretesOutpat-' .-\ Page NO...essse Roe g & - J fim? Psogzam to show 2D-Tsanslation of a yecugic | WN Source Code- | #f inctede < bits Jstde++-h> }-—T 2 H include
using namespace sid woid translate Rectangle. Cint pLI BI, int TLI) L LU int _gd= DETECT, gm, exvox code + init_gaaph (egg. 29m." )3 | Seteotos t2) § sectangle (plej Lo], plol Od, pLOCL, pUIED § \ plol fe] = Preyfoy + T Lei; | Plertt= eforlsi+Ttss; PLiJfo] = PLiJloy + T Led ; 4 | Pomo= ev od + TOL: rectangle (P Lol Lo] elol Cy, preytel, PEMIL) s int_main O $ 7 int p (2127 = 35,8, 12,18}: | _ int TOT: 32,44 | teansiate Rectangle CP,.71)3 seturn O03 Teacher's SIQNature.....cccesssesneteie LLOriginal Rectangle Teansiated Rectangle —IITTTdt idFf ra | — | —4 | — oa — POQE NO.wnnnl, oe ee | + L | 4 Or {4 Aim? © program to perform xeflection of the given 2D- image. Sousce Code— H include
/ include < conio-h» i Ht Include
\ | # include _
\ | : yoid_main ©) | r | ¢£ Le | int weode. begin G4] = fo,0.0,0}, rf weodeend [4]: {0 00,01) | xgion code [4]; | int Wexmax ymax Wwe%Xmin, A-Ymio flag 20% | | float slope; tnt YY XLT Ke, Vee | {| |_| SE LeU |n "Cohen Su entes Xmin WW. Xmin, LA-Srmin) 5 tin first enter Xmen. Vina =”) 5 | i inte U ln ‘Now | anf Uthd hd” 8 {| printf (' | eanf Nefad tod, & We Xmax QW-Smar); I | vintf£CC\n please enjes_ initial point X andy ="); a seanf lh fd", 2% kV); - — | Teacher's Signature... — \ _f printf ("\n Now entes final point x1 4 cant ("hd end’ &xt fyt): Cleayclevice () + si . ettangle (A Xmin, A-Ymin, WL Xmax, WY max) | line (4% Y,
We Xxmax) i weodew begin omic I Right Flag 3 7 o if (x< HL_Xmin) i Teacher's SIQMature........ cecex Cohen sutpestand Une dipping algorithmny min = 100 £00 Now, entex Xmin» J ¥rmax = 450 450 first enter xmax 5 Please ente® Now, ontes final point xt and y41= 50 - Befose clipping the Line- enitial point X Andy =Sco oy- — TT jo J a fF Neode-end[0J:t; Fflag= 1+ 7 a if LYt< W_ymin) { weocte_end (t]=1: __M Bottom// Flag=ts | if (X03 Whe xmax) i seode-end [2J>15 _ _ Flag eins 4 tf (1
65 70 Translation of Object -7 _| Aim: Program fox =the implementation ( | 4 i i 1 —o (got no. POgE NO. Pe of an object Code — | tH include
te include
Ht include <_math-h int _maeX , Men mid %, midy $ void axisC) Une (mid x, 0, mid, mary) Line CO, midy maxX mid) 5 void main i oy, Zang Xt. x2, SE N25 int gd.gm NG» 25 of SD- Sealing a + j detect graph (kad ogo). u gf g init graph (ag kgm," eyes setfillstyle (3, 25) maxx = gelmaxxt) 5 =J S maxy = maxsC) 5 maxy zgetmaxy 0} a mi = maxx) 2 ; midy = maxy /2 Out text xy C100, 100," ORIGINAL OBJECT"): Teacher's SIQNAture...... cereaothpec.o2 Date. 2 POQE NOs BE 3 Line (mid, 0, midx, maxy) 3 Une LO, midy, maxx, midy) 3 bar 3D (midx +100, midy ~ 20. midx+6o, midy- 60, 20,5); axis() 3 Outtext xy (100, 20 " seAtING’) 5 "yy printf ("|n Entes _-the ecaling Factor: scant Ui! thd hed “bd”, 2X ez); bay 3D (midx+ 100 midy- 20, midx+ 60, ——— midy- 60 20,5) > | bar 3D midx+ Or oo), midy= (y* 20), midet — x*60 micty (960), (20%2).523 | (ee ae ee | etchO: ——— | [ten lente : | en [2 or __ | ae eS ee a [ese A aORIGINAL OBJECT SCALING Entes the Sealing factor: 2,2,2 Merl a
You might also like
Cg
PDF
No ratings yet
Cg
19 pages
Vipin Sir Assignment
PDF
No ratings yet
Vipin Sir Assignment
20 pages
Computer Graphics LAB ECS-554: Rampur Road Moradabad
PDF
No ratings yet
Computer Graphics LAB ECS-554: Rampur Road Moradabad
19 pages
Computer Graphics Lab Manual (1)
PDF
No ratings yet
Computer Graphics Lab Manual (1)
13 pages
CG File
PDF
No ratings yet
CG File
54 pages
Computer Graphics File 2
PDF
No ratings yet
Computer Graphics File 2
22 pages
CGR Practicals output Full
PDF
No ratings yet
CGR Practicals output Full
29 pages
Program To Draw A Teddy Bear: Output
PDF
No ratings yet
Program To Draw A Teddy Bear: Output
31 pages
Compter Graphics File - 1
PDF
No ratings yet
Compter Graphics File - 1
28 pages
Nikita Chaudhary CGMA Practical file bca-c
PDF
No ratings yet
Nikita Chaudhary CGMA Practical file bca-c
25 pages
Computer Graphics Lab Manual: (Type Text) CSE/6 /CG Lab/Prepared by Vivek Kumar Sinha
PDF
No ratings yet
Computer Graphics Lab Manual: (Type Text) CSE/6 /CG Lab/Prepared by Vivek Kumar Sinha
66 pages
Graphics Lab: Department of Computer Science and Engineering
PDF
No ratings yet
Graphics Lab: Department of Computer Science and Engineering
64 pages
Computer Graphics Lab Report
PDF
No ratings yet
Computer Graphics Lab Report
42 pages
CG Final
PDF
No ratings yet
CG Final
19 pages
Write A Program To Draw The Line Using Line Function.: Output
PDF
No ratings yet
Write A Program To Draw The Line Using Line Function.: Output
37 pages
Kajal
PDF
No ratings yet
Kajal
74 pages
Pranav ACG
PDF
No ratings yet
Pranav ACG
35 pages
CG Lab-Record-Full
PDF
No ratings yet
CG Lab-Record-Full
46 pages
CGMA LAB FILE
PDF
No ratings yet
CGMA LAB FILE
41 pages
Lab Report 1
PDF
No ratings yet
Lab Report 1
14 pages
cg
PDF
No ratings yet
cg
53 pages
Abrar CG
PDF
No ratings yet
Abrar CG
14 pages
CG 6-9
PDF
No ratings yet
CG 6-9
15 pages
Cgrs
PDF
No ratings yet
Cgrs
21 pages
Cs2405 Computer Graphics Laboratory L T
PDF
No ratings yet
Cs2405 Computer Graphics Laboratory L T
21 pages
Color
PDF
No ratings yet
Color
13 pages
Computer Graphics MANUAL
PDF
100% (1)
Computer Graphics MANUAL
43 pages
Bresan Harmalgorithm
PDF
No ratings yet
Bresan Harmalgorithm
14 pages
Anuditcg Lab
PDF
No ratings yet
Anuditcg Lab
12 pages
LAB MAN GM
PDF
No ratings yet
LAB MAN GM
59 pages
Graphics LAB: Anmol Goel 422/IC/12 ICE-1, 4 Semester N.S.I.T
PDF
No ratings yet
Graphics LAB: Anmol Goel 422/IC/12 ICE-1, 4 Semester N.S.I.T
46 pages
Q1. Write A C Program To Implement DDA Line Drawing Algorithm
PDF
No ratings yet
Q1. Write A C Program To Implement DDA Line Drawing Algorithm
21 pages
2016ump3537 2
PDF
No ratings yet
2016ump3537 2
23 pages
Maharaja Surajmal Institute: Practical IX - CG Lab (BCA 351)
PDF
No ratings yet
Maharaja Surajmal Institute: Practical IX - CG Lab (BCA 351)
62 pages
CG Labset Programs
PDF
No ratings yet
CG Labset Programs
11 pages
CG Lab Manual
PDF
100% (1)
CG Lab Manual
56 pages
CAD Lab - Exp - 1 - 7 - by - Anil Gupta
PDF
No ratings yet
CAD Lab - Exp - 1 - 7 - by - Anil Gupta
46 pages
Program #1 Implementation of Line Generation Using DDA Algorithms
PDF
No ratings yet
Program #1 Implementation of Line Generation Using DDA Algorithms
27 pages
CGR Code 123
PDF
No ratings yet
CGR Code 123
35 pages
Computer Graphics Lab
PDF
No ratings yet
Computer Graphics Lab
25 pages
CPP Programs
PDF
No ratings yet
CPP Programs
117 pages
Practical 5
PDF
No ratings yet
Practical 5
23 pages
Infant Jesus College of Engineering Keelavallanadu: CS 1355 Graphics & Multimedia Lab Manual
PDF
No ratings yet
Infant Jesus College of Engineering Keelavallanadu: CS 1355 Graphics & Multimedia Lab Manual
26 pages
Graphics Practical
PDF
No ratings yet
Graphics Practical
15 pages
CG practical
PDF
No ratings yet
CG practical
15 pages
Practical CG Sim
PDF
No ratings yet
Practical CG Sim
35 pages
Computer
PDF
No ratings yet
Computer
48 pages
CGMT Practical - File
PDF
No ratings yet
CGMT Practical - File
27 pages
Computer Graphics Lab Assignment
PDF
100% (1)
Computer Graphics Lab Assignment
9 pages
Lab Exercise
PDF
No ratings yet
Lab Exercise
81 pages
School of Computer Science and Engineering Winter Session 2020-21
PDF
No ratings yet
School of Computer Science and Engineering Winter Session 2020-21
45 pages
Computer Graphics Programs in C - What You Will Learn?
PDF
No ratings yet
Computer Graphics Programs in C - What You Will Learn?
11 pages
College of Technology
PDF
No ratings yet
College of Technology
18 pages
Program To Draw A Triangle and A Line
PDF
No ratings yet
Program To Draw A Triangle and A Line
10 pages
CG
PDF
No ratings yet
CG
95 pages
Program To Draw A Line Using Dda Algorithm
PDF
No ratings yet
Program To Draw A Line Using Dda Algorithm
50 pages
CG_lab_file
PDF
No ratings yet
CG_lab_file
26 pages
CG All Practicals
PDF
No ratings yet
CG All Practicals
33 pages