5 Drawing Stuff in 2D

Size: px
Start display at page:

Download "5 Drawing Stuff in 2D"

Transcription

1 16 Advanced Java for Bioinformatics, WS 17/18, D. Huson, November 6, Drawing Stuff in 2D The scene graph is a tree whose nodes are layout items, controls and, as we will see, graphic objects. JavaFX has full knowledge of the scene graph and analyses it to generate appropriate calls to basic drawing methods to render the scene. You, as a programmer, focus on setting up the scene graph and JavaFX takes care of rendering the scene for you. In contrast, Swing uses the immediate rendering model in which you, as a programmer, are handed a Graphics object that provides basic drawing methods that you must use to draw the scene directly. For example: This requires the following code in public void paint ( Graphics g ) { g. drawline ( 1 5, 1 5, 2 1 5, 1 5 ) ; // s t a r t. x, s t a r t. y, end. x, end. y g. drawline ( 1 1 5, 1 5, 1 1 5, ) ; g. f i l l O v a l ( 1 0, 1 0, 1 0, 1 0 ) ; // x, y, width, h e i g h t g. f i l l O v a l ( 1 1 0, 1 0, 1 0, 1 0 ) ; g. f i l l O v a l ( 2 1 0, 1 0, 1 0, 1 0 ) ; g. f i l l R e c t ( 1 1 0, 1 1 0, 1 0, 1 0 ) ; } If you really need to use the immediate rendering model, then this can be done in JavaFX using the Canvas class, as we will discuss later. However, our main focus is on using the scene graph to setup the scene and we will leave rendering to JavaFX. In JavaFX, we can create shapes and add them to the scene graph. Example: This is based on the following code in JavaFX: C i r c l e c i r c l e 1=new C i r c l e ( 1 0, 1 0, 5 ) ; C i r c l e c i r c l e 2=new C i r c l e ( 1 1 0, 1 0, 5 ) ; C i r c l e c i r c l e 3=new C i r c l e ( 2 1 0, 1 0, 5 ) ; Rectangle r e c t a n g l e=new Rectangle ( 1 0, 1 0 ) ; r e c t a n g l e. setx ( ) ;

2 Advanced Java for Bioinformatics, WS 17/18, D. Huson, November 6, r e c t a n g l e. sety ( ) ; Line l i n e 1=new Line ( 1 0, 1 0, 2 1 0, 1 0 ) ; Line l i n e 2=new Line ( 1 1 0, 1 0, 1 1 0, ) ; Pane pane=new Pane ( ) ; pane. getchildren ( ). addall ( l i n e 1, l i n e 2, c i r c l e 1, c i r c l e 2, c i r c l e 3, r e c t a n g l e ) ; Scene scene=new Scene ( pane, 2 5 0, ) ; 5.1 Shapes JavaFX provides a number of extensions of the class Shape extends Node, which represent two dimensional shapes Rectangles The class Rectangle represents a rectangle: x,y width height It has the specific properties x, y, width and height. It has a number of additional properties that are common to most shapes: fill - the fill color stroke - the stroke color strokewidth - the stroke width It also has node properties that modify the location, scale etc.: translatex translatey translatez scalex Circles and ellipses The Circle class has the specific properties: radius, centerx and centery. The Ellipse class has the specific properties:

3 18 Advanced Java for Bioinformatics, WS 17/18, D. Huson, November 6, 2017 radiusx, radiusy, centerx and centery. radiusy centerx,centery radiusx Union, intersect and subtract A shape can be defined as the union of two shapes: C i r c l e c i r c l e 1=new C i r c l e ( 1 1 0, 1 1 0, 8 0 ) ; C i r c l e c i r c l e 2=new C i r c l e ( 2 1 0, 1 1 0, 3 0 ) ; Shape union=shape. union ( c i r c l e 1, c i r c l e 2 ) ; union. s e t F i l l ( Color.TRANSPARENT) ; union. s e t S t r o k e ( Color.BLACK) ; The result: A call to Shape.intersection(circle1,circle2) produces this: A call to Shape.subtract(circle1,circle2) produces this:

4 Advanced Java for Bioinformatics, WS 17/18, D. Huson, November 6, Line The Line class respresents a straight line. It specific properties are: startx, starty, endx and endy. There are other properties, here are some of the most commonly used ones: strokewidth strokelinecap, possible values: ROUND SQUARE BUTT strokedasharray, e.g.: 5, 3 specifies that 5 pixels of line are followed by 3 pixels of space PolyLine A PolyLine represents a path of straight lines, setup as follows: PolyLine polyline=new PolyLine(a 0,a 1,a 2,...,a ( 2k 1), where k > 1 is the number of points and k 1 is the number of lines. For example, polyline=new Polyline(10,10,20,100,200,30,220,110); looks like this: One additional property that a polyline has is

5 20 Advanced Java for Bioinformatics, WS 17/18, D. Huson, November 6, 2017 strokelinejoin - determines the shape of the joint between two consecutive line segments Polygon A Polygon is a closed poly-line for which the fill property can be set. For example, polygon=new Polygon(10,10,20,100,200,30,220,110); polygon.setfill(color.lightgray); polygon.setstroke(color.black); looks like this: Arc An Arc is a segment from an ellipse. The ellipse is defined using these properties: centerx, centery, radiusx and radiusy. The segment is then defined using these properties: startangle in degrees length - the angular extent in degrees length startangle type, one of these: ArcType.ROUND ArcType.CHORD ArcType.OPEN QuadCurve A QuadCurve represents a quadratic Bézier curve, specified by three points, the start point, a control point and the end point.

6 Advanced Java for Bioinformatics, WS 17/18, D. Huson, November 6, The control point determines the direction of the curve as it leaves the start point and as it enters the end point. The key properties are: startx, starty controlx, controly endx, endy Here is an example that uses quadratic curves in the display of a phylogenetic tree. The control points are shown as red dots: CubicCurve The class CubicCurve represents cubic B ezier curves. control points and an end point. These have four points, a start point, two The two control points determine the direction in which the curve leaves and enters the start and end, and the convex hull of the four points contains the total curve. The key properties are: startx, starty controx1, controly1 controx2, controly2 endx, endy Here is an example that uses cubic curves. The control points are shown as red and black dots:

7 22 Advanced Java for Bioinformatics, WS 17/18, D. Huson, November 6, Path A more general Path can be built from individual types of lines using the following classes: ArcTo ClosePath CubicCurveTo HLineTo LineTo MoveTo QuadCurveTo VLineTo In the below modified example for cubic curves, some edges of the phylogenetic tree consist of two parts, a cubic curve followed by a straight line, as highlighted: This is the code that is used to draw each such edge in the tree:

8 Advanced Java for Bioinformatics, WS 17/18, D. Huson, November 6, f i n a l MoveTo moveto = new MoveTo( s t a r t. getx ( ), s t a r t. gety ( ) ) ; f i n a l CubicCurveTo cubiccurveto = new CubicCurveTo ( c o n t r o l 1. getx ( ), c o n t r o l 1. gety ( ), c o n t r o l 2. getx ( ), c o n t r o l 2. gety ( ), support. getx ( ), support. gety ( ) ) ; f i n a l HLineTo hlineto = new HLineTo ( end. getx ( ) ) ; edgeshape = new Path ( moveto, cubiccurveto, hlineto ) ; SVGPath An even more general approach for generating paths is provided by the class SVGPath. This allows one to use SVG specification strings to define a path, as produced by some interactive graphics tools Text A Text object displays text. Its properties include: X and Y font wrappingwidth in pixels underline bold... textaligment such as TextAlignment.LEFT Here is some code for setting up a Text object: Text t e x t=new Text ( B e z i e r curves are widely used i n computer g r a p h i c s to model smooth curves. \ n + As the curve i s completely contained i n the convex h u l l o f i t s c o n t r o l points, \ n + the p o i n t s can be g r a p h i c a l l y d i s p l a y e d and used to manipulate the curve i n t u i t i v e l y. \ n ) ; t e x t. setx ( 2 0 ) ; t e x t. sety ( 2 0 ) ; t e x t. setfont ( Font. f o n t ( Courier New ) ) ; This is the result: Good practice Put all shapes that belong together into a group, (for example, in a phylogenetic tree, a node might be represented by a circle and have an associated label) and then use properties of the group to translate, scale and rotation the collection of shapes. These groups themselves should be placed into higher-level groups when appropriate.

public void paintcomponent(graphics g) { Graphics2D g2 = (Graphics2D)g;... }

public void paintcomponent(graphics g) { Graphics2D g2 = (Graphics2D)g;... } 6.1 RANDERING The original JDK 1.0 had a very simple mechanism for drawing shapes. You select color and paint mode, and call methods of the Graphics class such as drawrect or filloval. The Java 2D API

More information

CS-202 Introduction to Object Oriented Programming

CS-202 Introduction to Object Oriented Programming CS-202 Introduction to Object Oriented Programming California State University, Los Angeles Computer Science Department Lecture 13 JavaFX Basics Part 2 Slides by Keenan Knaur The Image and ImageView Classes

More information

Chapter 14 JavaFX Basics. Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved.

Chapter 14 JavaFX Basics. Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved. Chapter 14 JavaFX Basics 1 Motivations JavaFX is a new framework for developing Java GUI programs. The JavaFX API is an excellent example of how the object-oriented principle is applied. This chapter serves

More information

Solution Notes. COMP 151: Terms Test

Solution Notes. COMP 151: Terms Test Family Name:.............................. Other Names:............................. ID Number:............................... Signature.................................. Solution Notes COMP 151: Terms

More information

SHAPES & TRANSFORMS. Chapter 12 of Pro WPF : By Matthew MacDonald Assist Lect. Wadhah R. Baiee. College of IT Univ.

SHAPES & TRANSFORMS. Chapter 12 of Pro WPF : By Matthew MacDonald Assist Lect. Wadhah R. Baiee. College of IT Univ. SHAPES & TRANSFORMS Chapter 12 of Pro WPF : By Matthew MacDonald Assist Lect. Wadhah R. Baiee. College of IT Univ. of Babylon - 2014 Understanding Shapes The simplest way to draw 2-D graphical content

More information

03 Vector Graphics. Multimedia Systems. 2D and 3D Graphics, Transformations

03 Vector Graphics. Multimedia Systems. 2D and 3D Graphics, Transformations Multimedia Systems 03 Vector Graphics 2D and 3D Graphics, Transformations Imran Ihsan Assistant Professor, Department of Computer Science Air University, Islamabad, Pakistan www.imranihsan.com Lectures

More information

Scalable Vector Graphics (SVG) vector image World Wide Web Consortium (W3C) defined with XML searched indexed scripted compressed Mozilla Firefox

Scalable Vector Graphics (SVG) vector image World Wide Web Consortium (W3C) defined with XML searched indexed scripted compressed Mozilla Firefox SVG SVG Scalable Vector Graphics (SVG) is an XML-based vector image format for twodimensional graphics with support for interactivity and animation. The SVG specification is an open standard developed

More information

JavaFX Basics. Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved. 1.

JavaFX Basics. Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved. 1. JavaFX Basics rights reserved. 1 Motivations JavaFX is a new framework for developing Java GUI programs. The JavaFX API is an excellent example of how the object-oriented principle is applied. This chapter

More information

JavaFX Technology Building GUI Applications With JavaFX - Tutorial Overview

JavaFX Technology Building GUI Applications With JavaFX - Tutorial Overview avafx Tutorial Develop Applications for Desktop and Mobile Java FX 2/10/09 3:35 PM Sun Java Solaris Communities My SDN Account Join SDN SDN Home > Java Technology > JavaFX Technology > JavaFX Technology

More information

Roadmap for tonight. What are Bezier curves (mathematically)? Programming Bezier curves (very high level view).

Roadmap for tonight. What are Bezier curves (mathematically)? Programming Bezier curves (very high level view). Roadmap for tonight Some background. What are Bezier curves (mathematically)? Characteristics of Bezier curves. Demo. Programming Bezier curves (very high level view). Why Bezier curves? Bezier curves

More information

Lecture IV Bézier Curves

Lecture IV Bézier Curves Lecture IV Bézier Curves Why Curves? Why Curves? Why Curves? Why Curves? Why Curves? Linear (flat) Curved Easier More pieces Looks ugly Complicated Fewer pieces Looks smooth What is a curve? Intuitively:

More information

Java How to Program, 9/e. Copyright by Pearson Education, Inc. All Rights Reserved.

Java How to Program, 9/e. Copyright by Pearson Education, Inc. All Rights Reserved. Java How to Program, 9/e Copyright 1992-2012 by Pearson Education, Inc. All Rights Reserved. Overview capabilities for drawing two-dimensional shapes, controlling colors and controlling fonts. One of

More information

@Override public void start(stage primarystage) throws Exception { Group root = new Group(); Scene scene = new Scene(root);

@Override public void start(stage primarystage) throws Exception { Group root = new Group(); Scene scene = new Scene(root); Intro to Drawing Graphics To draw some simple graphics, we first need to create a window. The easiest way to do this in the current version of Java is to create a JavaFX application. Previous versions

More information

EXAMINATIONS 2017 TRIMESTER 2

EXAMINATIONS 2017 TRIMESTER 2 EXAMINATIONS 2017 TRIMESTER 2 CGRA 151 INTRODUCTION TO COMPUTER GRAPHICS Time Allowed: TWO HOURS CLOSED BOOK Permitted materials: Silent non-programmable calculators or silent programmable calculators

More information

EXAMINATIONS 2016 TRIMESTER 2

EXAMINATIONS 2016 TRIMESTER 2 EXAMINATIONS 2016 TRIMESTER 2 CGRA 151 INTRODUCTION TO COMPUTER GRAPHICS Time Allowed: TWO HOURS CLOSED BOOK Permitted materials: Silent non-programmable calculators or silent programmable calculators

More information

Week 5: Images & Graphics. Programming of Interactive Systems. JavaFX Images. images. Anastasia Bezerianos. Anastasia Bezerianos

Week 5: Images & Graphics. Programming of Interactive Systems. JavaFX Images. images. Anastasia Bezerianos. Anastasia Bezerianos Programming of Interactive Systems Week 5: Images & Graphics Anastasia Bezerianos introduction.prog.is@gmail.com Anastasia Bezerianos introduction.prog.is@gmail.com!2 1 2 JavaFX Images images In JavaFX

More information

Introduction to HTML5

Introduction to HTML5 Introduction to HTML5 Creating Lines, Rectangles, Setting Colors, Gradients, Circles and Curves By Dana Corrigan Intro This document is going to talk about the basics of HTML, beginning with creating primitive

More information

Generating Vectors Overview

Generating Vectors Overview Generating Vectors Overview Vectors are mathematically defined shapes consisting of a series of points (nodes), which are connected by lines, arcs or curves (spans) to form the overall shape. Vectors can

More information

Grafica e non solo: Java FX

Grafica e non solo: Java FX Grafica e non solo: Java FX Creazione di una Applicazione JavaFX public class JavaFXApplica/onTEST extends Applica/on { @Override public void start(stage primarystage) { BuCon btn = new BuCon(); btn.settext("say

More information

(SSOL) Simple Shape Oriented Language

(SSOL) Simple Shape Oriented Language (SSOL) Simple Shape Oriented Language Madeleine Tipp Jeevan Farias Daniel Mesko mrt2148 jtf2126 dpm2153 Description: SSOL is a programming language that simplifies the process of drawing shapes to SVG

More information

Introduction p. 1 Java Features p. 2 Java Expansion p. 4 Getting, Setting Up, and Using Java p. 5 The Java Language p. 5 Java Swing Components p.

Introduction p. 1 Java Features p. 2 Java Expansion p. 4 Getting, Setting Up, and Using Java p. 5 The Java Language p. 5 Java Swing Components p. Introduction p. 1 Java Features p. 2 Java Expansion p. 4 Getting, Setting Up, and Using Java p. 5 The Java Language p. 5 Java Swing Components p. 6 Components, Containers, and Layour Management p. 6 Checkboxes,

More information

DC2 File Format. 1. Header line 2. Entity line 3. Point line 4. String line

DC2 File Format. 1. Header line 2. Entity line 3. Point line 4. String line DC2 File Format The DesignCAD DC2 drawing file is an ASCII file, with the data present in character format. Each "record" in the file is actually a line in a text file. There are four types of records,

More information

Beautiful User Interfaces with JavaFX

Beautiful User Interfaces with JavaFX Beautiful User Interfaces with JavaFX Systémes d acquisition 3EIB S. Reynal September 20, 2017 The current document is dedicated to giving you a small and quick insight into the JavaFX API, an extra Java

More information

INKSCAPE BASICS. 125 S. Prospect Avenue, Elmhurst, IL (630) elmhurstpubliclibrary.org. Create, Make, and Build

INKSCAPE BASICS. 125 S. Prospect Avenue, Elmhurst, IL (630) elmhurstpubliclibrary.org. Create, Make, and Build INKSCAPE BASICS Inkscape is a free, open-source vector graphics editor. It can be used to create or edit vector graphics like illustrations, diagrams, line arts, charts, logos and more. Inkscape uses Scalable

More information

Graphical User Interfaces

Graphical User Interfaces Graphical User Interfaces CSC 1051 Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Outline Pixels & bits & colors JavaFX Introduction

More information

Graphical User Interfaces

Graphical User Interfaces Graphical User Interfaces CSC 1051 Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website: http://www.csc.villanova.edu/~map/1051/

More information

Lecture 7 A First Graphic Program And Data Structures & Drawing

Lecture 7 A First Graphic Program And Data Structures & Drawing Lecture 7 A First Graphic Program And Data Structures & Drawing Objective The objective is that you will understand: How to program the generation of 2D and 3D images. How to manipulate those images through

More information

Inkscape Tutorial. v2.0. Simon Andrews.

Inkscape Tutorial. v2.0. Simon Andrews. Inkscape Tutorial v2.0 Simon Andrews simon.andrews@babraham.ac.uk What is Inkscape? Vector Graphics Editor Free Software Cross Platform Easy to use Good for: Compositing Drawing Not for: Bitmap editing

More information

Graphical User Interfaces

Graphical User Interfaces Graphical User Interfaces CSC 1051 Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website: http://www.csc.villanova.edu/~map/1051/

More information

This is the vector graphics "drawing" technology with its technical and creative beauty. SVG Inkscape vectors

This is the vector graphics drawing technology with its technical and creative beauty. SVG Inkscape vectors 1 SVG This is the vector graphics "drawing" technology with its technical and creative beauty SVG Inkscape vectors SVG 2 SVG = Scalable Vector Graphics is an integrated standard for drawing Along with

More information

For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to

For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to access them. Contents at a Glance About the Author...x

More information

Definizione dei costru'ori

Definizione dei costru'ori Costru'ori Definizione dei costru'ori Se per una classe A non scrivo nessun costru'ore, il sistema automa9camente crea il costru'ore A(); Se invece definisco almeno un costru'ore non void, ad es. A(int

More information

CS474 MULTIMEDIA TECHNOLOGY

CS474 MULTIMEDIA TECHNOLOGY CS474 MULTIMEDIA TECHNOLOGY Pr. G. Tziritas, Spring 2018 SVG Animation Tutorial G. Simantiris (TA) OVERVIEW Introduction Definitions SVG Creating SVGs SVG basics Examples Animation using software Examples

More information

Graphics. HCID 520 User Interface Software & Technology

Graphics. HCID 520 User Interface Software & Technology Graphics HCID 520 User Interface Software & Technology PIXELS! 2D Graphics 2D Graphics in HTML 5 Raster Graphics: canvas element Low-level; modify a 2D grid of pixels.

More information

Graphics. HCID 520 User Interface Software & Technology

Graphics. HCID 520 User Interface Software & Technology Graphics HCID 520 User Interface Software & Technology PIXELS! 2D Graphics 2D Raster Graphics Model Drawing canvas with own coordinate system. Origin at top-left, increasing down and right. Graphics

More information

Graphics (Output) Primitives. Chapters 3 & 4

Graphics (Output) Primitives. Chapters 3 & 4 Graphics (Output) Primitives Chapters 3 & 4 Graphic Output and Input Pipeline Scan conversion converts primitives such as lines, circles, etc. into pixel values geometric description a finite scene area

More information

Dgp _ lecture 2. Curves

Dgp _ lecture 2. Curves Dgp _ lecture 2 Curves Questions? This lecture will be asking questions about curves, their Relationship to surfaces, and how they are used and controlled. Topics of discussion will be: Free form Curves

More information

Paths. "arc" (elliptical or circular arc), and. Paths are described using the following data attributes:

Paths. arc (elliptical or circular arc), and. Paths are described using the following data attributes: Paths Paths are described using the following data attributes: "moveto" (set a new current point), "lineto" (draw a straight line), "arc" (elliptical or circular arc), and "closepath" (close the current

More information

Paint Tutorial (Project #14a)

Paint Tutorial (Project #14a) Paint Tutorial (Project #14a) In order to learn all there is to know about this drawing program, go through the Microsoft Tutorial (below). (Do not save this to your folder.) Practice using the different

More information

XDesign Version User Guide

XDesign Version User Guide XDesign Version.0 - User Guide [0-09-] www.touchaware.com This document describes the XDesign user interface and provides step-by-step instructions on how to use the features in the app. 00-0 TouchAware

More information

CISC 1600 Lecture 3.1 Introduction to Processing

CISC 1600 Lecture 3.1 Introduction to Processing CISC 1600 Lecture 3.1 Introduction to Processing Topics: Example sketches Drawing functions in Processing Colors in Processing General Processing syntax Processing is for sketching Designed to allow artists

More information

CS337 INTRODUCTION TO COMPUTER GRAPHICS. Describing Shapes. Constructing Objects in Computer Graphics. Bin Sheng Representing Shape 9/20/16 1/15

CS337 INTRODUCTION TO COMPUTER GRAPHICS. Describing Shapes. Constructing Objects in Computer Graphics. Bin Sheng Representing Shape 9/20/16 1/15 Describing Shapes Constructing Objects in Computer Graphics 1/15 2D Object Definition (1/3) Lines and polylines: Polylines: lines drawn between ordered points A closed polyline is a polygon, a simple polygon

More information

How to create shapes. Drawing basic shapes. Adobe Photoshop Elements 8 guide

How to create shapes. Drawing basic shapes. Adobe Photoshop Elements 8 guide How to create shapes With the shape tools in Adobe Photoshop Elements, you can draw perfect geometric shapes, regardless of your artistic ability or illustration experience. The first step to drawing shapes

More information

Graphics and Java 2D Introduction OBJECTIVES. One picture is worth ten thousand words.

Graphics and Java 2D Introduction OBJECTIVES. One picture is worth ten thousand words. 1 2 12 Graphics and Java 2D One picture is worth ten thousand words. Chinese proverb Treat nature in terms of the cylinder, the sphere, the cone, all in perspective. Paul Cézanne Colors, like features,

More information

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Describing Shapes. Constructing Objects in Computer Graphics 1/15

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Describing Shapes. Constructing Objects in Computer Graphics 1/15 Describing Shapes Constructing Objects in Computer Graphics 1/15 2D Object Definition (1/3) Lines and polylines: Polylines: lines drawn between ordered points A closed polyline is a polygon, a simple polygon

More information

1st Point. 2nd Point. hold shift & drag along Y. Splines

1st Point. 2nd Point. hold shift & drag along Y. Splines Splines STEP 1: open 3DS Max _ from the Command Panel under the Create tab click on Shapes (note: shapes are really Splines) _ under Object Type click on Ellipse STEP 2: Expand the Keyboard Entry tab type

More information

Agenda. Programming Seminar. By: dr. Amal Khalifa. Coordinate systems Colors Fonts Drawing shapes Graphics2D API

Agenda. Programming Seminar. By: dr. Amal Khalifa. Coordinate systems Colors Fonts Drawing shapes Graphics2D API Agenda Coordinate systems Colors Fonts Drawing shapes Graphics2D API By: dr. Amal Khalifa 1 Programming Seminar @12:30 13:30 pm on Wednesday 9/4/2014 Location : 2.505.01 Painting components 2 Every component

More information

GUI Output. Adapted from slides by Michelle Strout with some slides from Rick Mercer. CSc 210

GUI Output. Adapted from slides by Michelle Strout with some slides from Rick Mercer. CSc 210 GUI Output Adapted from slides by Michelle Strout with some slides from Rick Mercer CSc 210 GUI (Graphical User Interface) We all use GUI s every day Text interfaces great for testing and debugging Infants

More information

Classes. Integer Division. Thursday, October 23, March 13, 2008

Classes. Integer Division. Thursday, October 23, March 13, 2008 Classes March 13, 2008 1 Integer Division private static final int FACE_SIZE = HEAD_SIZE * (4/5); WARNING! FACE_SIZE is not 80% of the HEAD_SIZE! 4 and 5 are integers 4 / 5 is integer division and results

More information

Software System Components 1 Graphics

Software System Components 1 Graphics Software System Components 1 Graphics Shan He LECTURE 3 Introduction to Java 2D Graphics (II) 1.1. Outline of Lecture Review of what we learned Rendering Shapes 1.2. Review of what we learned Last lecture,

More information

Web Programming 1 Packet #5: Canvas and JavaScript

Web Programming 1 Packet #5: Canvas and JavaScript Web Programming 1 Packet #5: Canvas and JavaScript Name: Objectives: By the completion of this packet, students should be able to: use JavaScript to draw on the canvas element Canvas Element. This is a

More information

Learning to Code with SVG

Learning to Code with SVG Learning to Code with SVG Lesson Plan: Objective: Lab Time: Age range: Requirements: Resources: Lecture: Coding a Frog in SVG on a 600 by 600 grid Hands-on learning of SVG by drawing a frog with basic

More information

Designing effective scientific figures Introduction to Inkscape to finalise figures

Designing effective scientific figures Introduction to Inkscape to finalise figures Designing effective scientific figures Introduction to Inkscape to finalise figures Aiora Zabala, based on slides by Simon Andrews and Boo Virk Please, find and click on this icon on your computer: What

More information

CS3240 Human-Computer Interaction Lab Sheet Lab Session 2

CS3240 Human-Computer Interaction Lab Sheet Lab Session 2 CS3240 Human-Computer Interaction Lab Sheet Lab Session 2 Key Features of Silverlight Page 1 Overview In this lab, you will get familiarized with the key features of Silverlight, such as layout containers,

More information

SIMPLE APPLET PROGRAM

SIMPLE APPLET PROGRAM APPLETS Applets are small applications that are accessed on Internet Server, transported over Internet, automatically installed and run as a part of web- browser Applet Basics : - All applets are subclasses

More information

Paint/Draw Tools. Foreground color. Free-form select. Select. Eraser/Color Eraser. Fill Color. Color Picker. Magnify. Pencil. Brush.

Paint/Draw Tools. Foreground color. Free-form select. Select. Eraser/Color Eraser. Fill Color. Color Picker. Magnify. Pencil. Brush. Paint/Draw Tools There are two types of draw programs. Bitmap (Paint) Uses pixels mapped to a grid More suitable for photo-realistic images Not easily scalable loses sharpness if resized File sizes are

More information

Output models Drawing Rasterization Color models

Output models Drawing Rasterization Color models Output models Drawing Rasterization olor models Fall 2004 6.831 UI Design and Implementation 1 Fall 2004 6.831 UI Design and Implementation 2 omponents Graphical objects arranged in a tree with automatic

More information

INKSCAPE INTRODUCTION COMPONENTS OF INKSCAPE MENU BAR

INKSCAPE INTRODUCTION COMPONENTS OF INKSCAPE MENU BAR INKSCAPE Prepared by K. Srujana INTRODUCTION Inkscape began in 2003 as a code fork of the Sodipodia project. Sodipodi, developed since 1999, was itself based on Rsph Levien's Gill (Gnome Illustration Application).

More information

Creating a 2D Geometry Model

Creating a 2D Geometry Model Creating a 2D Geometry Model This section describes how to build a 2D cross section of a heat sink and introduces 2D geometry operations in COMSOL. At this time, you do not model the physics that describe

More information

Building Graphical user interface using JavaFX

Building Graphical user interface using JavaFX CS244 Advanced programming Applications Building Graphical user interface using JavaFX Dr Walid M. Aly Lecture 6 JavaFX vs Swing and AWT When Java was introduced, the GUI classes were bundled in a library

More information

CST141 JavaFX Basics Page 1

CST141 JavaFX Basics Page 1 CST141 JavaFX Basics Page 1 1 2 5 6 7 8 9 10 JavaFX Basics CST141 Console vs. Window Programs In Java there is no distinction between console programs and window programs Java applications can mix (combine)

More information

pysvg Tutorial Lets start with the typical "hello world" which I have already packed into a method.

pysvg Tutorial Lets start with the typical hello world which I have already packed into a method. pysvg Tutorial Working with pysvg is relatively straight forward. You (still) need some knowledge on what values the appropriate svg elements need. Apart of that it's a piece of cake. Note that parameters

More information

2D Object Definition (1/3)

2D Object Definition (1/3) 2D Object Definition (1/3) Lines and Polylines Lines drawn between ordered points to create more complex forms called polylines Same first and last point make closed polyline or polygon Can intersect itself

More information

Strategy. Using Strategy 1

Strategy. Using Strategy 1 Strategy Using Strategy 1 Scan Path / Strategy It is important to visualize the scan path you want for a feature before you begin taking points on your part. You want to try to place your points in a way

More information

How to...create a Video VBOX Gauge in Inkscape. So you want to create your own gauge? How about a transparent background for those text elements?

How to...create a Video VBOX Gauge in Inkscape. So you want to create your own gauge? How about a transparent background for those text elements? BASIC GAUGE CREATION The Video VBox setup software is capable of using many different image formats for gauge backgrounds, static images, or logos, including Bitmaps, JPEGs, or PNG s. When the software

More information

Ansoft HFSS Solids Menu

Ansoft HFSS Solids Menu Ansoft HFSS Use the commands on the Solids menu to: Draw simple 3D objects such as cylinders, boxes, cones, and spheres. Draw a spiral or helix. Sweep a 2D object to create a 3D object. 2D objects can

More information

CS250 Intro to CS II. Spring CS250 - Intro to CS II 1

CS250 Intro to CS II. Spring CS250 - Intro to CS II 1 CS250 Intro to CS II Spring 2017 CS250 - Intro to CS II 1 Topics Virtual Functions Pure Virtual Functions Abstract Classes Concrete Classes Binding Time, Static Binding, Dynamic Binding Overriding vs Redefining

More information

Graphics Applets. By Mr. Dave Clausen

Graphics Applets. By Mr. Dave Clausen Graphics Applets By Mr. Dave Clausen Applets A Java application is a stand-alone program with a main method (like the ones we've seen so far) A Java applet is a program that is intended to transported

More information

Grafica e non solo: Java FX

Grafica e non solo: Java FX Grafica e non solo: Java FX Creazione di una Applicazione JavaFX public class JavaFXApplica/onTEST extends Applica/on { @Override public void start(stage primarystage) { BuCon btn = new BuCon(); btn.settext("say

More information

INSTRUCTORS: A. SANPHAWAT JATUPATWARANGKUL A. NATTAPOL SUPHAWONG A. THEEPRAKORN LUNTHOMRATTANA COMPUTER AIDED DESIGN I AUTOCAD AND ILLUSTRATOR CS

INSTRUCTORS: A. SANPHAWAT JATUPATWARANGKUL A. NATTAPOL SUPHAWONG A. THEEPRAKORN LUNTHOMRATTANA COMPUTER AIDED DESIGN I AUTOCAD AND ILLUSTRATOR CS INSTRUCTORS: A. SANPHAWAT JATUPATWARANGKUL A. NATTAPOL SUPHAWONG A. THEEPRAKORN LUNTHOMRATTANA COMPUTER AIDED DESIGN I AUTOCAD AND ILLUSTRATOR CS BITMAP IMAGES VS VECTOR GRAPHICS WORKING WITH BITMAP IMAGES

More information

Computer Graphics. Chapter 4 Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1

Computer Graphics. Chapter 4 Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1 Computer Graphics Chapter 4 Attributes of Graphics Primitives Somsak Walairacht, Computer Engineering, KMITL 1 Outline OpenGL State Variables Point Attributes Line Attributes Fill-Area Attributes Scan-Line

More information

Horse in Mo&on. HorseInMo&on

Horse in Mo&on. HorseInMo&on Anima&on in JavaFX Horse in Mo&on HorseInMo&on Horse in Mo&on Esempio di Anima&on public void start(stage primarystage) { final String content = "Animazioni Java FX"; final Text text = new Text(10, 20,

More information

Working with images and scenes

Working with images and scenes Working with images and scenes CS 5010 Program Design Paradigms Bootcamp Mitchell Wand, 2012-2014 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 1 Lesson

More information

The Syntax of Digital Illustration: SVG Commands

The Syntax of Digital Illustration: SVG Commands CHAPTER 7 The Syntax of Digital Illustration: SVG Commands By now you have an understanding of how to export to some of the major new media content publishing formats by using the export and save as functions

More information

Pocket Guide to Writing SVG. by Joni Trythall

Pocket Guide to Writing SVG. by Joni Trythall Pocket Guide to Writing SVG by Joni Trythall by Joni Trythall Published in 2014 by Joni Bologna On the web: www.svgpocketguide.com www.jonibologna.com Please send errors to: info@jonibologna.com Credits

More information

Ai Adobe. Illustrator. Creative Cloud Beginner

Ai Adobe. Illustrator. Creative Cloud Beginner Ai Adobe Illustrator Creative Cloud Beginner Vector and pixel images There are two kinds of images: vector and pixel based images. A vector is a drawn line that can be filled with a color, pattern or gradient.

More information

CS 101 Computer Science I Fall Instructor Muller. stddraw API. (DRAFT of 1/15/2013)

CS 101 Computer Science I Fall Instructor Muller. stddraw API. (DRAFT of 1/15/2013) CS 101 Computer Science I Fall 2013 Instructor Muller stddraw API (DRAFT of 1/15/2013) This document describes the application programmer interface (API) for the stddraw library. An API describes the set

More information

Krita Vector Tools

Krita Vector Tools Krita 2.9 05 Vector Tools In this chapter we will look at each of the vector tools. Vector tools in Krita, at least for now, are complementary tools for digital painting. They can be useful to draw clean

More information

Kimberly Nguyen Professor Oliehoek Introduction to Programming 8 September 2013

Kimberly Nguyen Professor Oliehoek Introduction to Programming 8 September 2013 1. A first program // Create 200x200 canvas // Print favorite quote size(200, 200); println("it is what it is"); // Draw rectangle and a line rect(100,100,50,50); line(0,0,50,50); // Save as.pde. Can be

More information

Computer Graphics. Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1

Computer Graphics. Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1 Computer Graphics Chapter 4 Attributes of Graphics Primitives Somsak Walairacht, Computer Engineering, KMITL 1 Outline OpenGL State Variables Point Attributes t Line Attributes Fill-Area Attributes Scan-Line

More information

Free-Form Deformation (FFD)

Free-Form Deformation (FFD) Chapter 14 Free-Form Deformation (FFD) Free-form deformation (FFD) is a technique for manipulating any shape in a free-form manner. Pierre Bézier used this idea to manipulate large numbers of control points

More information

CS 465 Program 4: Modeller

CS 465 Program 4: Modeller CS 465 Program 4: Modeller out: 30 October 2004 due: 16 November 2004 1 Introduction In this assignment you will work on a simple 3D modelling system that uses simple primitives and curved surfaces organized

More information

A Comprehensive Introduction to SolidWorks 2011

A Comprehensive Introduction to SolidWorks 2011 A Comprehensive Introduction to SolidWorks 2011 Godfrey Onwubolu, Ph.D. SDC PUBLICATIONS www.sdcpublications.com Schroff Development Corporation Chapter 2 Geometric Construction Tools Objectives: When

More information

Text and Graphics. Postcript is a Page Description Language! Paths

Text and Graphics. Postcript is a Page Description Language! Paths Postcript is a Page Description Language! Text and Graphics CSE 413, Autumn 2005 Programming Languages http://www.cs.washington.edu/education/courses/413/05au/ In the previous lectures I talked mostly

More information

Computer Graphics 1. Chapter 2 (May 19th, 2011, 2-4pm): 3D Modeling. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2011

Computer Graphics 1. Chapter 2 (May 19th, 2011, 2-4pm): 3D Modeling. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2011 Computer Graphics 1 Chapter 2 (May 19th, 2011, 2-4pm): 3D Modeling 1 The 3D rendering pipeline (our version for this class) 3D models in model coordinates 3D models in world coordinates 2D Polygons in

More information

HTML5 - SVG. SVG is mostly useful for vector type diagrams like Pie charts, Two-dimensional graphs in an X,Y coordinate system etc.

HTML5 - SVG. SVG is mostly useful for vector type diagrams like Pie charts, Two-dimensional graphs in an X,Y coordinate system etc. http://www.tutorialspoint.com/html5/html5_svg.htm HTML5 - SVG Copyright tutorialspoint.com SVG stands for Scalable Vector Graphics and it is a language for describing 2D-graphics and graphical applications

More information

SVG GRAPHICS LANGUAGE AS A DESCRIPTION OF A 2D PATH IN ROBOT PROGRAMMING TASKS

SVG GRAPHICS LANGUAGE AS A DESCRIPTION OF A 2D PATH IN ROBOT PROGRAMMING TASKS S E L E C T E D E N G I N E E R I N G P R O B L E M S N U M B E R 5 I N S T I T U T E O F E N G I N E E R I N G P R O C E S S E S A U T O M A T I O N A N D I N T E G R A T E D M A N U F A C T U R I N G

More information

Corel Draw 11. What is Vector Graphics?

Corel Draw 11. What is Vector Graphics? Corel Draw 11 Corel Draw is a vector based drawing that program that makes it easy to create professional artwork from logos to intricate technical illustrations. Corel Draw 11's enhanced text handling

More information

Programming Fundamentals

Programming Fundamentals Programming Fundamentals Lecture 03 Introduction to Löve 2D Edirlei Soares de Lima Computer Graphics Concepts What is a pixel? In digital imaging, a pixel is a single

More information

Procedural decomposition examples

Procedural decomposition examples CS106 Handout #13 J Zelenski Jan 16, 2008 Procedural decomposition examples A note about graphics: The graphics library we use in CS106B/X supports simple pen-based drawing in a Cartesian coordinate system

More information

CS3621 Midterm Solution (Fall 2005) 150 points

CS3621 Midterm Solution (Fall 2005) 150 points CS362 Midterm Solution Fall 25. Geometric Transformation CS362 Midterm Solution (Fall 25) 5 points (a) [5 points] Find the 2D transformation matrix for the reflection about the y-axis transformation (i.e.,

More information

AutoCAD DWG Drawing Limitations in SAP 3D Visual Enterprise 9.0 FP03

AutoCAD DWG Drawing Limitations in SAP 3D Visual Enterprise 9.0 FP03 AutoCAD DWG Drawing Limitations in SAP 3D Visual Enterprise 9.0 FP03 AutoCAD Import Limitations The following is a list of AutoCAD features that will not give an expected viewable when using SAP 3D Visual

More information

Intro to Modeling Modeling in 3D

Intro to Modeling Modeling in 3D Intro to Modeling Modeling in 3D Polygon sets can approximate more complex shapes as discretized surfaces 2 1 2 3 Curve surfaces in 3D Sphere, ellipsoids, etc Curved Surfaces Modeling in 3D ) ( 2 2 2 2

More information

Bioinformatics Resources

Bioinformatics Resources Bioinformatics Resources Lecture & Exercises Prof. B. Rost, Dr. L. Richter, J. Reeb Institut für Informatik I12 Slides by D. Nechaev Recap! Why do we even bother with JavaScript?! Because JavaScript allows

More information

curl -sl sh

curl -sl  sh curl -sl http://goo.gl/f8j4l6 sh 2:1 3:1 4:1 type point = { x : int; y : int type rect = { rect_ll : point; rect_width : int; rect_height : int type circ = { circ_center : point; circ_radius : int type

More information

MULTIMEDIA WEB DESIGN

MULTIMEDIA WEB DESIGN CLASS :: 02 02.02 2018 4 Hours THE AGENDA HOMEWORK 1 REVIEW [ Upload to Comm Arts Server ] :: Completed Questionnaire :: Best Works [Saved to Server] GIF ANIMATION DEMO :: Best Practices for GIF Animations

More information

Week 4 Part 2. Introduction to 2D Graphics & Java 2D

Week 4 Part 2. Introduction to 2D Graphics & Java 2D Week 4 Part 2 Introduction to 2D Graphics & Java 2D 2D graphics Vector graphics! Use of geometric primitives: points, lines, curves, etc.! Primitives are created by using mathematical equations! Can be

More information

EDITING SHAPES. Lesson overview

EDITING SHAPES. Lesson overview 3 CREATING AND EDITING SHAPES Lesson overview In this lesson, you ll learn how to do the following: Create a document with multiple artboards. Use tools and commands to create basic shapes. Work with drawing

More information

How to draw and create shapes

How to draw and create shapes Adobe Flash Professional Guide How to draw and create shapes You can add artwork to your Adobe Flash Professional documents in two ways: You can import images or draw original artwork in Flash by using

More information

9. APPLETS AND APPLICATIONS

9. APPLETS AND APPLICATIONS 9. APPLETS AND APPLICATIONS JAVA PROGRAMMING(2350703) The Applet class What is an Applet? An applet is a Java program that embedded with web content(html) and runs in a Web browser. It runs inside the

More information