CPT 450 Computer Graphics 3rd Lecture.

Slides:



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

Chapter 9 Color, Sound and Graphics
COMPUTER PROGRAMMING I Objective 8.03 Apply Animation and Graphic Methods in a Windows Form (4%)
Graphics and Multimedia Session 13 Mata kuliah: M0874 – Programming II Tahun: 2010.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 21 - “Cat and Mouse” Painter Application.
User Interface Programming in C#: Graphics
Chapter 13 Graphics, Animation, Sound, and Drag-and-Drop Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Events. Events Single Event Handlers Click Event Mouse Events Key Board Events Create and handle controls in runtime Outline.
Slide Transitions Slide Show, Slide Transition opens Slide Transition task pane Practice each option setting to select the transition style, its speed,
Mouse draw Using the mouse and a palette to make a picture.
Graphics and Multimedia. Outline Introduction Graphics Contexts and Graphics Objects Color Control.
Graphics and Multimedia. Outline Drawing Polygons and Polylines Advanced Graphics Capabilities.
Chapter 13: Advanced GUI and Graphics
Visual Basic Graphics Warning: The way I am using Visual Basic graphics is somewhat different (and much simpler!) to that of the book. Use these slides.
Graphics and Multimedia. Introduction The language contains many sophisticated drawing capabilities as part of namespace System.Drawing and the other.
Graphics Images – PictureBox control Drawing graphics - Graphics object Multimedia controls PictureBox control Image property – select image Choose how.
Computer Graphics Prof. Muhammad Saeed. Drawing and Transformation of Figures in C# August 1,
1 Chapter 26 D&D – Graphics Outline 26.1 Introduction 26.3 Graphics Contexts and Graphics Objects 26.4 Color Control 26.5 Font Control 26.6 Drawing Lines,
Graphics Standard Grade Computing. Graphics Package n A graphics package is another General Purpose Package. n It is used to draw pictures on the monitor.
CS324e - Elements of Graphics and Visualization Java2D Graphics.
Lecture Set 13 Drawing Mouse and Keyboard Events Part A - Drawing.
XP Tutorial 7 New Perspectives on Microsoft Windows XP 1 Microsoft Windows XP Working with Graphics Tutorial 7.
Computer Programming and Basic Software Engineering 9 Building Graphical User Interface A Brief Introduction to GDI+ S.R.G. Fraser, Pro Visual C++/CLI.
MATH WORD WALL A quick “How-To” guide to success!.
CST238 Week 5 Questions / Concerns? Announcements – HW#1 due (Project ideas) – Check-off Take Home lab#4 Recap New topics – Drawing Coming up: – GUI Bloopers.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 26 – CheckWriter Application Introducing Graphics.
1 Windows Graphics. 2 Objectives You will be able to Use the Windows GDI+ to draw arbitrary figures and text on a Windows form. Add a handler for the.
Object Oriented Programming Graphics and Multimedia Dr. Mike Spann
C# Programming Lecture 4 “GDI+” PGL01/CSP/2006.
CSC 298 Windows Forms.
Graphics and Multimedia Part #2
© 2010 Delmar, Cengage Learning Chapter 2: Drawing Objects in Adobe Flash.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved CheckWriter Application Introducing Graphics and Printing.
Chapter2: Drawing a Window. Drawing with the GDI.
Mimio Making Madness How can I create a lesson using Mimio? In this session, you will see and use all the unique tools to create an exciting lesson that.
Timer, Animation Responding to Mouse & Keyboard Lab 7 7 McGraw-Hill© 2006 The McGraw-Hill Companies, Inc. All rights reserved.
GDI+ 1. Objectives 2 GDI+ class  Create and render Graphic  Display information on the computer screen, printer 3.
Chapter 9 Fireworks: Part I The Web Warrior Guide to Web Design Technologies.
INT 840E Computer graphics Introduction & Graphic’s Architecture.
Lecture 5 Graphics Erick Pranata. » Graphics Overview » About GDI+ » Getting Started.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 21 - “Cat and Mouse” Painter Application.
1 Graphic Device Interface (GDI). 2 Class Form A Form is a representation of any window displayed in your application. The Form class can be used to create.
PHOTOSHOP TOOLS. Photoshop Tools are categorized into 4 unique categories as followed:
Graphics and Multimedia. OUTLINE Font Control Drawing Lines, Rectangles and Ovals Drawing Arcs Drawing a General Path.
List Boxes and Combo Boxes Provides a list of items to select from Various styles — choose based on Space available Need to select from an existing list.
Windows Programming C# Software Development. Overview  DLLs / PInvoke  DirectX .NET Component Library  Custom Controls  Event Model (in C++)  GUI.
 2002 Prentice Hall. All rights reserved. 1 Outline Mouse Event Handling Keyboard Event Handling Graphical User Interface Concepts:
Paint Tutorial Created February 2006 Start Paint: Start>Programs>Accessories>Paint.
GDI +. Graphics class's methods System.Drawing Graphics Objects.
Copyright © Texas Education Agency, All rights reserved.1 Web Technologies Creating a Navigation Bar.
(PART II) Graphics and Multimedia. Font Control Font s  After a Font is created, its properties cannot be modified  Programmers must create a new Font.
Graphics and Multimedia 2 Lecture 8. OUTLINE Font Control Drawing Lines, Rectangles and Ovals Drawing a General Path.
(PART II) Graphics and Multimedia 11/02/1437 Lect6 (Part 2)
MS Paint A simple drawing tool that can be used to create simple or elaborate drawings. These drawings can be either black-and-white or color, and can.
Text on a curve.
Flash Interface, Commands and Functions
Graphics and Multimedia
Computer Programming I
Graphics and Multimedia
"Digital Media Primer" Yue-Ling Wong, Copyright (c)2013 by Pearson Education, Inc. All rights reserved.
Drawing Mouse and Keyboard Events Part A - Drawing
ThS. Nguyễn Hà Giang Khoa CNTT - Hutech
CASE Tools Graphical User Interface Programming Using C#
Chapter Lessons Use the Macromedia Flash drawing tools
Extend Text Editor to Draw shapes
May 14, 2015 Ferris Wheel 3-D transition effect and pictures (Basic)
Repetition and Multiple Forms
Graphics and Multimedia
Chapter 12 Graphics in Windows and the Web
Presentation transcript:

CPT 450 Computer Graphics 3rd Lecture

GDI+ Vector Graphics Require Drawing Surface Represented as a Graphics Object Form, Control (Picture Box), Printer, Bitmap) Pen or Brush Process Drawing (or Filling) method

Creating a Graphics Object Dim g as Graphics = new Graphics ‘ won’t work! In the Paint Event of a form Form1_paint(sender as object, e as PaintEventArgs) Dim g as Graphics = e.Graphics Elsewhere Dim g as Graphics = me.createGraphics

Project 1 – Drawing Program This project requires you to keep track of the mouse clicks and the state of the program. Drawing different types of shapes required different numbers of mouse clicks. 1 click - Points and text 2 clicks - Line segments, ellipses and rectangles 3 clicks – Arcs 4 clicks – Beziers N>=4 clicks - Curves

Mouse Events Use these events to know where the user has clicked the mouse button. Note: The form and a control on the form such as a picture box each have their own separate events, depending on if the user clicks on the control or the background of the form. Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown ‘ Your code here End Sub Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove

Mouse Events Use the returned value e (of type MouseEventArgs) to determine the position and type of the mouse event. e.x e.y e.button

Finite State Machines Computer programs can be thought of as machines that have finite states (or modes) Our project 1 will have different states depending on the clickNumber. FSA can be modeled as computer graphs, with states represented as vertices and transitions represented as edges of the graph. State1 transition State2

ATAN versus ATAN2 Located in Math namespace ATAN ATAN2 Input: y/x Output: angle (in radians) [-pi/2, pi/2] ATAN2 Inputs: y, x Output: angle (in radians) [-pi, pi] Angle (in Deg) = Angle (in Radian)*180/PI Error handling: division by zero, when x = 0

Pens Solid Pens Color property Width property DashStyle property Constructor sets color and line width Dim myPen As New Pen(Color.Black, 1) Color property Controls pen color Width property Controls the pen’s line width DashStyle property Controls the line style (solid, dashed, dotted, etc.)

Brushes Programmer can only instantiate descendants of brush class. No constructor for a brush – it is called an abstract base class. solidBrush Constructor sets color Dim myBrush As Brush = New SolidBrush(Color.Black) HatchBrush Constructor sets color and HatchStyle And many other types of brushes

Fonts Contructor initializes the font family and size Dim myFont As New Font("Times New Roman", 10) Bold, Italics, size properties