BGI graphics library And Visual Studio.

Slides:



Advertisements
Similar presentations
Copyright 2006 by Pearson Education 1 Building Java Programs Supplement 3G: Graphics.
Advertisements

 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.
Noadswood Science,  To know how to use Python to produce windows and colours along with specified co-ordinates Sunday, April 12, 2015.
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)
Laboratory Study II October, Java Programming Assignment  Write a program to calculate and output the distance traveled by a car on a tank of.
Introduction to Programming
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.
Chapter 2 Programming by Example. A Holistic Perspective Three sections separated by blank lines. Program comment File: FileName.java
Building Java Programs Supplement 3G Graphics Copyright (c) Pearson All rights reserved.
1 A Simple Applet. 2 Applets and applications An application is an “ordinary” program Examples: Notepad, MS Word, Firefox, Halo, etc. An applet is a Java.
C++ Graphics Primitives April 15th. void clearscreen(int c) –clear the screen to background color c –If c = 1 screen black.
Copyright 2008 by Pearson Education Building Java Programs Graphics reading: Supplement 3G videos: Ch. 3G #1-2.
Copyright 2008 by Pearson Education Building Java Programs Graphics reading: Supplement 3G videos: Ch. 3G #1-2.
Copyright 2006 by Pearson Education 1 Building Java Programs Supplement 3G: Graphics.
Four simple expressions in meta. Data objects Pieces of data in a computer are called objects Today, we’ll talk about four kinds of objects Numbers Pictures.
1 Graphical objects We will draw graphics in Java using 3 kinds of objects: DrawingPanel : A window on the screen. Not part of Java; provided by the authors.
1 Interface Types & Polymorphism & introduction to graphics programming in Java.
C++ Basics Structure of a Program. C++ Source Code Plain text file Typical file extension .CPP Must compile the C++ source code without errors before.
Graphics in C language Lecture by Jameel Asghar IT Manager Department of CS&IT NED University of Engineering and Technology, Karachi.
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.
Copyright 2010 by Pearson Education Building Java Programs Graphics reading: Supplement 3G.
Lecture 15: Intro to Graphics Yoni Fridman 7/25/01 7/25/01.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 2 Graphics Programming with C++ and the Dark GDK Library Starting.
© A+ Computer Science - Chicken yeller = new Chicken();
Lesson 10 Using AutoShapes, WordArt, and Comments Lesson 10 Using AutoShapes, WordArt, and Comments.
Graphic Basics in C ATS 315. The Graphics Window Will look something like this.
(C) 2010 Pearson Education, Inc. All rights reserved.  Class Graphics (from package java.awt) provides various methods for drawing text and shapes onto.
Object Oriented Programming Dr. Ennis-Cole CECS 5100.
1 Sung-Ju Kang Department of Physics Kangwon National University Basic Concept of The Computer Graphic. For the investigation of the physical problem by.
Graphics and Java2D Chapter Java Coordinate System Origin is in _____________ corner –Behind title bar of window X values increase to the ________.
1 A Simple Applet. 2 Applets and applications An applet is a Java program that runs on a web page Applets can be run within any modern browser To run.
Documenting a function. Documenting a function definition We have a template for information that we need you to put at the top of each function - if.
Building Java Programs Graphics Reading: Supplement 3G.
CS305j Introduction to Computing Simple Graphics 1 Topic 11 Simple Graphics "What makes the situation worse is that the highest level CS course I've ever.
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%)
Spreadsheet Vocabulary Multimedia Lab Kathleen Pape.
Copyright 2008 by Pearson Education Building Java Programs Graphics reading: Supplement 3G videos: Ch. 3G #1-2.
VG101 RECITATION 5 By TAs. CONTENTS How to read Vg101Class.h Samples about graphics About assignment 5 Array.
PowerPoint Vocabulary Tabs 1. Backgrounds: Backgrounds are used in presentations to create a more interesting eye-pleasing look. Backgrounds may include.
CS 115 Lecture 6 Graphics Taken from notes by Dr. Neil Moore.
Prime & Composite Numbers Prime & Composite Numbers © Math As A Second Language All Rights Reserved 4.OA#4.
Surface Area I can calculate the surface area of a prism Direction:
Surface Area Tutorial Read and answer the questions on each slide.
Building Java Programs
Building Java Programs
Building Java Programs
9/17/2018 Kiến Trúc Máy Tính.
Graphics Part I Taken from notes by Dr. Neil Moore
Basic Graphics Drawing Shapes 1.
Lecture No 9 Graphics.
Smart Graphic Layout TOPIC statement
Project title Scheduled dates Team members JAN FEB MAR APR MAY JUN
Topic 8 graphics "What makes the situation worse is that the highest level CS course I've ever taken is cs4, and quotes from the graphics group startup.
Building Java Programs
Building Java Programs
SSEA Computer Science: Track A
Using PARAMETERS In Java.
Chapter 2 Graphics Programming with C++ and the Dark GDK Library
Graphics Part I Taken from notes by Dr. Neil Moore
Building Java Programs
Building Java Programs
Building Java Programs
Building Java Programs
Building Java Programs
Building Java Programs
Building Java Programs
Graphics Reading: Supplement 3G
Building Java Programs
Presentation transcript:

BGI graphics library And Visual Studio

Layout of graphics window X  increasing 0, 0 Y increasing 639, 479

Prolog required for every graphics program #include “graphics.h” - same place as other includes AND inside main() start graphics code with initwindow (x, y); // x is the number of pixels horizontally // and y is the number of pixels vertically or initwindow (x, y, string); // where string is the title to go in // the title bar of the graphics window

Required at end of program closegraph(); usually right before return 0; if you want to pause the graphics window you can use getch(); this is a function that will get a character from the keyboard and discard it

Functions x = getmaxx(); y = getmaxy(); return the highest x value and y value possible in the current graphics mode These can be useful if you want something centered in the window putpixel (x/2, y/2, RED); would put a tiny red dot in the middle of the window

To pause the program getch(); strictly this does return the character that was pressed on the keyboard, but for this use we do not care what character was pressed. So the function can be called as a “void” function, i.e. on a line by itself

More Functions - Color void setcolor (int color); color used to draw with void setfillpattern (SOLID_FILL, BLUE); will cause any 'filled' or 'bar' calls after that to fill in solidly with blue BLUE, GREEN, CYAN, RED and so on are named constants (actually integers) that you can use as color arguments; SOLID_FILL, LINE_FILL, SLASH_FILL are the same for fill patterns

More functions void line (int x1, int y1, int x2, int y2 ); draws a line from (x1, y1) to (x2, y2) line (25, 50, 35, 50); // horizontal void rectangle (int left, int top, int right, int bottom); rectangle (150, 200, 400, 350); // a box that is 250 pixels wide and 150 tall

Another function outtextxy(x, y, "This is a test."); (x,y) is where the text will start on the screen if you want to pass a string variable to this function, you must use outtextxy (x, y, const_cast<char*>(str.c_str())); where str is the name of the string variable