Graphics and Multimedia

Slides:



Advertisements
Similar presentations
2D Graphics Drawing Things. Graphics In your GUI, you might want to draw graphics E.g. draw lines, circles, shapes, draw strings etc The Graphics class.
Advertisements

Graphics and Multimedia Session 13 Mata kuliah: M0874 – Programming II Tahun: 2010.
User Interface Programming in C#: Graphics
GUI and Swing, part 2 The illustrated edition. Scroll bars As we have previously seen, a JTextArea has a fixed size, but the amount of text that can be.
1 L36 Graphics and Java 2D™ (1). 2 OBJECTIVES  To understand graphics contexts and graphics objects.  To understand and be able to manipulate colors.
©2004 Brooks/Cole Applets Graphics & GUIs. Figures ©2004 Brooks/Cole CS 119: Intro to JavaFall 2005 Graphical Programs Most applications these days are.
Graphics Programming. In this class, we will cover: The difference between AWT and Swing Creating a frame Frame positioning Displaying information in.
Chapter 13 Graphics, Animation, Sound, and Drag-and-Drop Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Graphics and Multimedia. Outline Introduction Graphics Contexts and Graphics Objects Color Control.
Graphics and Multimedia. Outline Drawing Polygons and Polylines Advanced Graphics Capabilities.
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.
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,
Lecture Set 13 Drawing Mouse and Keyboard Events Part A - Drawing.
Computer Programming and Basic Software Engineering 9 Building Graphical User Interface A Brief Introduction to GDI+ S.R.G. Fraser, Pro Visual C++/CLI.
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.
1 Graphical User Components (II) Outline JTextArea Creating a Customized Subclass of JPanel JPanel Subclass that Handles Its Own Events Windows: Additional.
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
Chapter 15 Graphics and Java 2D™ Java How to Program, 8/e (C) 2010 Pearson Education, Inc. All rights reserved.
Chapter 28 - Java Graphics and Java2D Outline 28.1Introduction 28.2Graphics Contexts and Graphics Objects 28.3Color Control 28.4Font Control 28.5Drawing.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved CheckWriter Application Introducing Graphics and Printing.
Lecture 15: Intro to Graphics Yoni Fridman 7/25/01 7/25/01.
GDI+ 1. Objectives 2 GDI+ class  Create and render Graphic  Display information on the computer screen, printer 3.
Graphics Copyright © 2015 by Maria Litvin, Gary Litvin, and Skylight Publishing. All rights reserved. Java Methods Object-Oriented Programming and Data.
Lecture 5 Graphics Erick Pranata. » Graphics Overview » About GDI+ » Getting Started.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Introduction to Android (Part.
(C) 2010 Pearson Education, Inc. All rights reserved.  Class Graphics (from package java.awt) provides various methods for drawing text and shapes onto.
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.
Merete S COLLEGEFACULTY OF ENGINEERING & SCIENCE Graphics ikt403 – Object-Oriented Software Development.
Ray Konopka Creating Custom Microsoft.NET Framework Controls in Delphi.
Ray Konopka Developing Custom.NET Components DevCon Course No: 3118.
Graphics and Java2D Chapter Java Coordinate System Origin is in _____________ corner –Behind title bar of window X values increase to the ________.
Graphics and Multimedia. OUTLINE Font Control Drawing Lines, Rectangles and Ovals Drawing Arcs Drawing a General Path.
Images Part 11 dbg. 2 Images The form and several controls can display a number of different types of image files in the BackgroundImage Property. These.
1 Introduction to Graphics b The last one or two sections of each chapter of the textbook focus on graphical issues b Most computer programs have graphical.
Windows Programming C# Software Development. Overview  DLLs / PInvoke  DirectX .NET Component Library  Custom Controls  Event Model (in C++)  GUI.
1 Drawing C Sc 335 Object-Oriented Programming and Design Rick Mercer.
(PART III) Graphics and Multimedia 16/02/1437 Lect6 CT
GDI +. Graphics class's methods System.Drawing Graphics Objects.
1 Sections 5.1 – 5.2 Digital Image Processing Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Graphics JavaMethods An Introduction to Object-Oriented Programming Maria Litvin Gary Litvin Copyright © 2003 by Maria Litvin, Gary Litvin, and Skylight.
10/20/2005week71 Graphics, mouse and mouse motion events, KeyEvent Agenda Classes in AWT for graphics Example java programs –Graphics –Mouse events –Mouse.
(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)
Chapter 1: An Introduction to Visual Basic 2015
Flash Interface, Commands and Functions
Graphics and Multimedia
Computer Programming I
Programming Windows with C# Chapter23 Metafiles
Drawing Mouse and Keyboard Events Part A - Drawing
Chapter 14 JavaFX Basics Dr. Clincy - Lecture.
ThS. Nguyễn Hà Giang Khoa CNTT - Hutech
CASE Tools Graphical User Interface Programming Using C#
Graphics -- Introduction
Graphics and Multimedia
Lecture 9 GUI and Event Driven CSE /16/2019.
Repetition and Multiple Forms
Object Oriented Programming
Graphics and Multimedia
Chapter 12 Graphics in Windows and the Web
CPT 450 Computer Graphics 3rd Lecture.
Presentation transcript:

Graphics and Multimedia

Introduction The language contains many sophisticated drawing capabilities as part of namespace System.Drawing and the other namespaces that make up the .NET resource GDI+. GDI+ is an application programming interface (API) that provides classes for creating two-dimensional graphics, and manipulating fonts and images. The most commonly used components of GDI+ reside in the System.Drawing and System.Drawing.Drawing2D namespaces.

System.Drawing namespace’s Classes and Structures. Bitmap Font   FontFamily Graphics Icon Pen Region SolidBrush TextureBrush Image HatchBrush LinearGradient PathGradient class Structure Color Point Rectangle Size Key Class System.Drawing namespace’s Classes and Structures.

Introduction Class Graphics contains methods used for drawing Strings, lines, rectangles and other shapes on a Control. The drawing methods of class Graphics usually require a Pen or Brush object to render a specified shape. The Pen draws shape outlines; the Brush draws solid objects

Introduction Structure Color has: Class Font has: Class FontFamily has properties to set color of various graphical components. Methods to create new colors. Class Font has: Properties to define unique fonts Class FontFamily has Methods for obtaining font information.

Introduction GDI+’s coordinate system is a scheme for identifying every point on the screen. To begin drawing in Visual Basic, we first must understand GDI+’s coordinate system: Upper-left corner of component has coordinates (0, 0) Coordinate pairs: Allow positioning of text and shapes Horizontal coordinate (x-coordinate) Distance to the right from upper-left corner Vertical coordinate (y-coordinate) Distance down from upper-left corner Coordinate units measured in pixels Used with structures Rectangle and Point that are provided by System.Drawing namespace

Introduction Rectangle structure defines rectangular shapes with ( width & height ) dimension. Point structure represents the x-y coordinates of a point on a two-dimensional plane.

Graphics Contexts and Graphics Objects Graphics objects contain methods for drawing, font manipulation, color manipulation and other graphics-related actions. Every Windows application that derives from class System.Windows.Forms.Form inherits an Overridable OnPaint method where most graphics operations are performed. The arguments to the OnPaint method include a PaintEventArgs object from which we can obtain a Graphics object for the control. The OnPaint method triggers the Control’s Paint event.

Graphics Contexts and Graphics Objects When displaying graphical information on a control, we need to: Access Graphics object of the control. Then, use Graphics object to draw shapes and strings on the control. Graphics object Can be accessed in 2 ways: By overriding OnPaint() method to retrieve a Graphics object from argument PaintEventArgs Create a new Graphics object associated with the appropriate surface.

Graphics Contexts and Graphics Objects 1-Overriding OnPaint() : Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) ‘ extract the Graphics object from the PaintEventArgs argument: Dim graphicsObject As Graphics = e.Graphics Calling the OnPaint method raises the Paint event. Instead of overriding the OnPaint method, programmers can add an event handler for the Paint event because OnPaint method is rarely called directly. Public Sub MyEventHandler_Paint( _ ByVal sender As Object, ByVal e As PaintEventArgs) _ Handles Me.Paint

OnPaint is called automatically by system when events occur such as moving or resizing of windows. Similarly, when controls( such as Label or Button) are displayed the program calls that controls paint method. Programmers can invoke OnPaint explicitly by calling Invalidate method. This method refreshes a control’s client area and repaints all graphical components.

Graphics Context and Graphics Objects 2-Creating a new Graphics: By invoking CreateGraphics method. Dim graphicsObject As Graphics = label1.CreateGraphics() Then, you can use the methods provided in class Graphics to draw on the control for example we can draw a circle on label1 graphicsObjects.DrawCircle(……)

Color Control Structure Color ARGB values Alpha, red, green and blue values, respectively Each value represented as a Byte Alpha value determines intensity 0 = transparent, 255 = opaque color. The first number in the RGB value defines the amount of red in the color, the second defines the amount of green and the third defines the amount of blue. The larger the value, the greater the amount of that particular color.

Color Control

Color Control

Color Control Pen objects Brush objects Programmers draw shapes and Strings using Brushes and Pens. Pen objects functions similarly to an ordinary pen, is used to draw lines. constructors allow programmers to specify the colors and widths of the lines that they wish to draw. Pens collection (System.Drawing) contains predefined Pens. Brush objects Used to color interiors of shapes In most Fill methods, Brushes fill a space with a color, pattern or image. Upcoming example: Color value and alpha demonstration

Color Control