C++ Graphics Primitives April 15th. void clearscreen(int c) –clear the screen to background color c –If c <= 0 screen white –If c >= 1 screen black.

Slides:



Advertisements
Similar presentations
Text Box + Picture A PowerPoint Tutorial. Go to Insert>Picture>Autoshapes.
Advertisements

Copyright 2006 by Pearson Education 1 Building Java Programs Supplement 3G: Graphics.
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.
 putpixel function plots a pixel at location (x, y) of specified color.  Declaration :- void putpixel(int x, int y, int color);
Graphics Shapes. Setup for using graphics You have to import the graphics library You can use either “import graphics” or “from graphics import *” or.
BGI graphics library And Visual Studio.
Borland Style Graphics for Dev C++)
Graphics in MS-DOS Environment LEE HUN HEE. 1.Real Coordinate and Windows Coordinate ● Real Coordinate ->(x,y) ● Windows Coordinate ->(wx,wy) ∴ (x,y)->(wx,wy)
Graphics You draw on a Graphics object The Graphics object cannot directly be created by your code, instead one is generated when the method paintComponent.
Graphics Chapter 16.  If you want to draw shapes such as a bar chart, a clock, or a stop sign, how do you do it?
PHY-102 SAPIntroductory GraphicsSlide 1 Introductory Graphics In this section we will learn how about how to draw graphics on the screen in Java:  Drawing.
LAB SESSION 7 Graphical user interface Applet fundamentals Methods in applets Execution of an applet Graphics class.
Lecture # 11 JavaScript Graphics. Scalable Vector Graphics (SVG) Scalable Vector Graphics (SVG), as the name implies, are - scalable (without pixelation):
An Interactive Book About Math Vocabulary By Mrs. Emmer-Miller.
Creating a Mouse Maze This tutorial will cover step-by-step how to create a mouse maze like the one above. The goal of these mazes is to reach the end.
Chapter 7 Introduction to High-Level Language Programming.
2D Graphics in Java COMP53 Nov 14, Applets and Applications Java applications are stand-alone programs – start execution with main() – runs in JVM.
OOP&M - laboratory lectures1 OOP&M – LAB3 LABtres: drawing.
1. Menu File | Acquisition | Simple 2. Type in a name for the participant 3. Click on the ”Go” button to start recording Ticking this box will prevent.
2 What is pyGame? A set of Python modules to make it easier to write games. –home page: –documentation:
 A tool that allows you to select through a free hand method › Unlike the marquee which defines the shape of your selection.
GRAPHICS AND MOUSE PROGRAMMING IN C. Turbo C has a good collection of graphics libraries. If you know the basics of C, you can easily learn graphics programming.
L-1 Lecture 13: Functions and Design © 2000 UW CSE University of Washington Computer Programming I.
Element. The element Used to dynamically draw graphics using javascript. Capable of drawing paths, circles, rectangles, text, and images.
Computer Science 112 Fundamentals of Programming II Graphics Programming.
Lecture 15: Intro to Graphics Yoni Fridman 7/25/01 7/25/01.
How to Make Location Map.
Introduction to Using the Notebook 10 Software for SMART Board Day 2 LIVINGSTON PARISH PUBLIC SCHOOLS Facilitated by S. Waltman.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Lecture 02b: Tutorial for Programming in Processing Jarek Rossignac.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 21.1 Test-Driving the Painter Application.
GRAPHICS MODULE 14 STUDY BOOK. Graphic commands SCREEN - puts the screen into graphics mode WINDOW - allows scaling of the screen LINE - 3 formats –LINE.
Recursion Pepper. Another way to loop Call yourself repeatedly until you say to stop. Example: add up 10 numbers using addUp. -- Input – number to count.
Introduction to Java Chapter 8 - Introduction to Java Graphics1 Chapter 8 Introduction to Java Graphics.
IS 1014 Introduction to Computer Graphics -- Paul Munro A Postscript Tutorial Book available at: cdf.fnal.gov/offline/PostScript/BLUEBOOK.PDF.
Calculating the area of a leaning triangle. Calculating Area.
Pslib Manual. 2 PSlib Pslib is a library for making “postscript (ps)” file. Postscript is a language for supporting the high-quality printer. Postscript.
CRE Programming Club - Class 5 Robert Eckstein and Robert Heard.
E-Board Features North Dakota University System 2008.
Midterm: Question 1 (35%) (30 minutes) Write an assembly program to draw a rectangle. – (5%) Show a message to ask for information of the rectangle – (5%)
Paint Tutorial Created February 2006 Start Paint: Start>Programs>Accessories>Paint.
Equations of Circles. You can write an equation of a circle in a coordinate plane, if you know: Its radius The coordinates of its center.
1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Processing  Install Processing  Learn how to edit, run, save, export,
Programming for Art: Arrays – 2D ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 16 Fall 2010.
There are many kinds of shapes. Look around you, There are shapes in everything you see.
CS 115 Lecture 7 Graphics – coordinate systems, Text, Entry, aliases Taken from notes by Dr. Neil Moore.
L-1 Lecture 12: Functions and Design © 2000 UW CSE University of Washington Computer Programming I.
VG101 RECITATION 5 By TAs. CONTENTS How to read Vg101Class.h Samples about graphics About assignment 5 Array.
Basic Graphics 03/03/16 & 03/07/16 Imagine! Java: Programming Concepts in Context by Frank M. Carrano, (c) Pearson Education - Prentice Hall, 2010.
CS 115 Lecture 6 Graphics Taken from notes by Dr. Neil Moore.
CompSci 4 Java 4 Apr 14, 2009 Prof. Susan Rodger.
Turtle Graphics Just keep swimming …. Fill Shapes turtle.fillcolor(“#color_code”) turtle.begin_fill() turtle.end_fill() ■You must tell turtle when to.
THE MOUSE Left Click THE MOUSE Right Click.
CSE / ENGR 142 Programming I
First text statement positioned here at guide intersection
Basic Graphics Drawing Shapes 1.
Extend Text Editor to Draw shapes
موضوع بحث: تعریف علم اصول جلسه 43.
اشاره به نتایج قیاس های فقهی گاهی، حکم شرعی است
CSc 337 Lecture 21: Canvas.
Introduction to Turtle Graphics
STEP ONE. STEP ONE. STEP ONE. STEP ONE. STEP ONE. 02
Exam1 Review CSE113 B.Ramamurthy 4/17/2019 B.Ramamurthy.
Recursion Pepper.
Turtle Graphics Just keep swimming ….
قاعده لا ضرر، تنها در شبهات حکمیه جاری است
Chapter 14 Drawing in a Window
Spell your name using word art from above
CSc 337 Lecture 19: Canvas.
1 ج : اشاره بعضی از اصولیون به تعریف ترکیبی آخوند با «یک لفظ»
Presentation transcript:

C++ Graphics Primitives April 15th

void clearscreen(int c) –clear the screen to background color c –If c <= 0 screen white –If c >= 1 screen black

void moveto(int x, int y) –Cursor moves to position (x,y) (without drawing anything on the screen) –The value x must be between 0 and maxX –The value y must be between 0 and maxY

int getmaxx() Return the integer value of maxX for the screen int getmaxy() Return the integer value of maxX for the screen

Example void main () { int x,y; x = getmaxx(); y = getmaxy(); moveto(x/2, y/2); }

void setcolor(int c) –Set the color of the pen that will be drawing lines and shapes on screen to color c –If c <= 0 pen color white –If c >= 1 pen color black –Note: white pen on white screen (also black pen on black screen) will not show up (can be used to erase)

void lineto(int x, int y) –Draw a straight line from current position of cursor to position (x,y) on screen using current pen color –Example: … clearscreen(0); //screen white setcolor(1); //pen black moveto(20,20); //move cursor to (20,20) lineto(100,100);

void rectangle(int x1, int y1, int x2, int y2) –Draw a rectangle with upper left corner at position (x1, y1) and lower right corner (x2, y2)

void circle(int x, int y, int r) –Draw a circle with center at (x,y) and radius r

void writedraw(type value, int x, int y) - where type can be int, char or a text (string) - display the value at position (x,y) on screen Example:... writedraw(3, 10, 10); writedraw(“Stop right here!!”, 100, 100); writedraw(‘a’, 25, 25); …

void getmouse(int &x, int &y) –Get into x and y the current mouse coordinates at the instant when the mouse is clicked –Example: int x, y; getmouse(x,y); if (x <= 100 && y <= 100) { writedraw( “Bingo! You clicked in the upper left corner!”, 10, 10); } else { writedraw(“soryy…try again…”, 10, 10); }

Stop! Click here to exit