# Computer Graphics Prof. Muhammad Saeed Dept. of Computer Science & IT Federal Urdu University of Arts, Sciences and Technology.

## Presentation on theme: "Computer Graphics Prof. Muhammad Saeed Dept. of Computer Science & IT Federal Urdu University of Arts, Sciences and Technology."— Presentation transcript:

Computer Graphics Prof. Muhammad Saeed Dept. of Computer Science & IT Federal Urdu University of Arts, Sciences and Technology

Drawing and Transformation of Figures in C#

FUUASTDept. of Comp. Sc.& IT3 1. Basic Mathematics 1.Matrices i.Addition ii.Multiplication iii.Transpose iv. Inverse v.Algebraic Laws vi.Symmetric and Orthogonal 2.Geometry i.Coordinate systems ii. Introduction to 2D and 3D geometry iii.Basic trigonometric Formulae Transformation of Figures Computer Graphics

FUUASTDept. of Comp. Sc.& IT4 2. Transformations 1.Rotation i.Rotation matrices for 2D and 3D systems ii.Homogeneous coordinates iii.Rotation around any axis, Quaternions iv.Compound rotation, inverse rotation v.Orthogonality 2.Translation i.Translation matrices for 2D and 3D systems ii. Compound translations and rotations, inverse translation 3.Scaling i.Scaling matrix and its inverse ii.Compound scaling with other transformations Transformation of Figures Computer Graphics

FUUASTDept. of Comp. Sc.& IT5 4.Reflection i.Reflection matrices for 2D in axes and lines ii.Reflection in planes iii.Inverse reflection 5.Inversion i.Through the origin for 2D and 3D systems ii. Inverse inversion 6.Shearing Shearing a 3D figure 7.Representing 3D on 2D An approximate representation Transformation of Figures Computer Graphics

FUUASTDept. of Comp. Sc.& IT6 3.Programming in C# ……….. 1.C# GDI+ Introduction 2. Drawing Primitives i.Graphics class, color, pen, brush private void Form1_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; Pen pen = new Pen(Color.Blue, sizeOfPen); //Pen pen = new Pen(Color.FromArgb(red, green, blue)); Brush brush = new SolidBrush(Color.FromArgb(red, green, blue)); Point point = new Point(); Brush brush1=Brushes.DarkSeaGreen; } public void userDefinedFunction() { Graphics g = CreateGraphics(); } Transformation of Figures Computer Graphics

FUUASTDept. of Comp. Sc.& IT7 Transformation of Figures Computer Graphics ii.Line, circle, ellipse, rectangle, filled figures g.DrawLine(pen, x1,y1,x2,y2); g.DrawEllipse(pen, x1, y1, width, height); g.DrawRectangle(pen, x1, y1 width, height); g.FillEllipse(brush, x1, y1, width, height); iiiColor Common Dialog Box ColorDialog dlg = new ColorDialog(); dlg.FullOpen = true; Brush brush1; if (dlg.ShowDialog() == DialogResult.OK) { brush1 = new SolidBrush(dlg.Color); g.FillRectangle(brush1, x1, x2, width, height); } 3.Controls and Event Handling Menu Text Box, Label Button, Check Box, Radio Button Group Box Mouse & keyboard event handling

FUUASTDept. of Comp. Sc.& IT8 4.Transformations i.2D graphics, rotation, translation, scaling, reflection, inversion and shearing ii.Representing 3D on 2D iii.3D transformations of a wireframe object such acube 5.Lines and curves i.parametric and implicit equations of lines, curves and conics in 2D system. ( List given) ii.Bezier Curves and their properties 6.Morphing ( Tweening) i. introduction. ii. a simple 2D shape e.g. H to a house drawing 7.Clipping i.Cohen-Sutherland Algorithm ii.Cyrus-Beck Algorithm Transformation of Figures Computer Graphics

FUUASTDept. of Comp. Sc.& IT9 Transformation of Figures Computer Graphics 8. Advanced Features of C# i.2D transforms using System.Drawing.2D RotateTransform(angle) TranslateTransform(x-increment,y-increment) ScaleTransform(x-Factor, y-Factor) ResetTransform() ii.Image and Bitmap classes Image image = Image.FromFile(file Name) g.DrawImage(image,x,y,image.Width, image.Height) image.Save(File Name, imageFormat) Bitmap bitmap = new Bitmap(File Name) bitmap = (Bitmap)Bitmap.FromFile(File Name) Color color = bitmap.GetPixel(x,y) bitmap.SetPixel(x,y,color) bitmap.Save (File Name, imageFormat) //ImageFormat.Png 9.Introducing Fractals i.Definition & Types ( slides )slides ii.Examples( Slides One, Two, Three )OneTwoThree

FUUASTDept. of Comp. Sc.& IT10 The End Transformation of Figures Computer Graphics

Download ppt "Computer Graphics Prof. Muhammad Saeed Dept. of Computer Science & IT Federal Urdu University of Arts, Sciences and Technology."

Similar presentations