# Graphics by panniuniu

VIEWS: 105 PAGES: 10

• pg 1
```									Computer Graphics

Dept. of Computer Science & IT
Federal Urdu University of Arts, Sciences and Technology
Drawing and Transformation of Figures
in
C#
Transformation of Figures                            Computer Graphics

1. Basic Mathematics
1. Matrices
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

FUUAST                        Dept. of Comp. Sc.& IT                       3
Transformation of Figures                            Computer Graphics

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

FUUAST                        Dept. of Comp. Sc.& IT                       4
Transformation of Figures                            Computer Graphics

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

FUUAST                        Dept. of Comp. Sc.& IT                       5
Transformation of Figures                            Computer Graphics

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();
}

FUUAST                        Dept. of Comp. Sc.& IT                              6
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);
iii   Color 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
Text Box, Label
Group Box
Mouse & keyboard event handling

FUUAST                          Dept. of Comp. Sc.& IT                        7
Transformation of Figures                            Computer Graphics
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 a cube
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

FUUAST                        Dept. of Comp. Sc.& IT                       8
Transformation of Figures                               Computer Graphics
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 )
ii.   Examples        ( Slides One, Two, Three )

FUUAST                           Dept. of Comp. Sc.& IT                       9
Transformation of Figures                            Computer Graphics

The End

FUUAST                        Dept. of Comp. Sc.& IT                       10

```
To top