 putpixel function plots a pixel at location (x, y) of specified color.  Declaration :- void putpixel(int x, int y, int color);

Slides:



Advertisements
Similar presentations
Applets and Graphics.
Advertisements

Internet Basics & Way Beyond!
Copyright 2010 by Pearson Education Building Java Programs More Graphics reading: Supplement 3G.
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.
Lab # 03- SS Basic Graphic Commands. Lab Objectives: To understand M-files principle. To plot multiple plots on a single graph. To use different parameters.
Computer Graphics … how renderings are done on a computer. Art 321 Dr. J Parker Winter.
Lesson One: The Beginning
1 More on Applets Overview l Changing Colors l Changing Fonts & Styles l Applet Life-Cycle l Input using Dialog Window l Input using HTML parameters l.
Frame Windows A frame object is used to create a graphical frame window. This frame is used to show information in a graphical application. The JFrame.
Graphics Shapes. Setup for using graphics You have to import the graphics library You can use either “import graphics” or “from graphics import *” or.
CSE 1341 Honors Professor Mark Fontenot Southern Methodist University Note Set 21.
Object Oriented Programming one of the main reasons we now teach Java instead of C++. C++ was designed to be backwardly compatible with the original.
Object Oriented Programming one of the main reasons we now teach Java instead of C++. C++ was designed to be backwardly compatible with the original.
BGI graphics library And Visual Studio.
Borland Style Graphics for Dev C++)
Review of Math Class Methods abssqrt minmax powround ceilfloor.
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.
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.
Introduction to Programming
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?
Cosc 5/4730 Blackberry Drawing. Screen size With Blackberry devices, they have a known screen size in pixels. If you are programming for specific device.
BY Kamran Yousaf Line Attributes (X1, Y1, X2, Y2, Color) The Line Based on Slope Decision on the dx and dy Loop on Greater (Counter of 1) Increment of.
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.
Applets Graphical Java programs Run inside web browser Platform-neutral Easy deployment--loads when needed Secure.
C++ Graphics Primitives April 15th. void clearscreen(int c) –clear the screen to background color c –If c = 1 screen black.
Graphics Images – PictureBox control Drawing graphics - Graphics object Multimedia controls PictureBox control Image property – select image Choose how.
Title of project: pendulum waves. Pendulums Waves Pendulums Waves.
1 Getting Started: C-Revisions and Introduction to Graphics Next: Simulation Essentials, Memory Handling.
Graphics. Graphics Features in Java Topics to be covered Topics to be covered Graphics Basics Graphics Basics Coordinate System Coordinate System Graphics,
COMPUTER GRAPHICS Prepared by S.MAHALAKSHMI Asst. Prof(Sr) / SCSE VIT University.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 26 – CheckWriter Application Introducing Graphics.
Graphics and Multimedia Part #2
2D Graphics: Rendering Details
Session: 17. © Aptech Ltd. 2Canvas and JavaScript / Session 17  Describe Canvas in HTML5  Explain the procedure to draw lines  Explain the procedure.
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.
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.
Graphic Basics in C ATS 315. The Graphics Window Will look something like this.
Computer Graphics Prepared By: Bahram Taheri Sept Amirkabir University of Technology & Birmingham University.
Tkinter Canvas.
(C) 2010 Pearson Education, Inc. All rights reserved.  Class Graphics (from package java.awt) provides various methods for drawing text and shapes onto.
1 Sung-Ju Kang Department of Physics Kangwon National University Basic Concept of The Computer Graphic. For the investigation of the physical problem by.
Introduction to Java Chapter 8 - Introduction to Java Graphics1 Chapter 8 Introduction to Java Graphics.
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.
Paint Tutorial Created February 2006 Start Paint: Start>Programs>Accessories>Paint.
07 – HTML5 Canvas (1) Informatics Department Parahyangan Catholic University.
VG101 RECITATION 5 By TAs. CONTENTS How to read Vg101Class.h Samples about graphics About assignment 5 Array.
Graphics Drawing Things With Java. Today's Topics Course Updates Java Graphics –Java 1.1 versus Java 1.2 (Java 2) Drawing Lines Drawing Shapes.
12 Graphics and Java 2D™.
Autodesk Certified User: AutoCAD
Lesson One: The Beginning Chapter 1: Pixels Learning Processing Daniel Shiffman Presentation by Donald W. Smith Graphics from
Basic Graphics Drawing Shapes 1.
Lecture No 9 Graphics.
Smart Graphic Layout TOPIC statement
Order of Operations Problems
4.14 GUI and Graphics Case Study: Creating Simple Drawings (Cont.)
CASE Tools Graphical User Interface Programming Using C#
Graphics -- Introduction
SSEA Computer Science: Track A
Order of Operations Problems
Chapter 2 Graphics Programming with C++ and the Dark GDK Library
Autodesk Professional User: AutoCAD
TEXT TEXT TEXT Animated rectangles curve up and grow in sequence
نظریات پیرامون «تمایز علوم»
نظریات پیرامون «تمایز علوم» بررسی دلایل احتیاج علوم به موضوع
Chapter 14 Drawing in a Window
Chapter 16 Drawing in a Window
Presentation transcript:

 putpixel function plots a pixel at location (x, y) of specified color.  Declaration :- void putpixel(int x, int y, int color);

line function is used to draw a line from a point(x1,y1) to point(x2,y2) i.e. (x1,y1) and (x2,y2) are end points of the line.The code given below draws a line. void line(int x1, int y1, int x2, int y2);

#include #include main() { int gd = DETECT, gm; initgraph(&gd,&gm,"C:\\TC\\BGI"); line(100, 100, 200, 200); getch(); }

Declaration :- void circle(int x, int y, int radius); circle function is used to draw a circle with center (x,y) and third parameter specifies the radius of the circle. The code given below draws a circle.

main() { int gd = DETECT, gm; initgraph(&gd, &gm,"C:\\TC\\BGI"); circle(100, 100, 50); getch(); }

 Declaration :- void rectangle(int left, int top, int right, int bottom);  rectangle function is used to draw a rectangle. Coordinates of left top and right bottom corner are required to draw the rectangle. left specifies the X-coordinate of top left corner, top specifies the Y-coordinate of top left corner, right specifies the X-coordinate of right bottom corner, bottom specifies the Y-coordinate of right bottom corner. The code given below draws a rectangle.

main() { int gd = DETECT, gm; initgraph(&gd, &gm, "C:\\TC\\BGI"); rectangle(100,100,200,200); getch(); }

 Declaration :- void arc(int x, int y, int stangle, int endangle, int radius);  arc function is used to draw an arc with center (x,y) and stangle specifies starting angle, endangle specifies the end angle and last parameter specifies the radius of the arc. arc function can also be used to draw a circle but for that starting angle and end angle should be 0 and 360 respectively.

main() { int gd = DETECT, gm; initgraph(&gd, &gm, "C:\\TC\\BGI"); arc(100, 100, 0, 135, 50); getch(); }

 Declarations of ellipse function :- void ellipse(int x, int y, int stangle, int endangle, int xradius, int yradius);  Ellipse is used to draw an ellipse (x,y) are coordinates of center of the ellipse, stangle is the starting angle, end angle is the ending angle, and fifth and sixth parameters specifies the X and Y radius of the ellipse. To draw a complete ellipse strangles and end angle should be 0 and 360 respectively.

main() { int gd = DETECT, gm; initgraph(&gd, &gm, "C:\\TC\\BGI"); ellipse(100, 100, 0, 360, 50, 25); getch(); }

 Declaration of fillellipse function :- void fillellipse(int x, int y, int xradius, int yradius);  x and y are coordinates of center of the ellipse, xradius and yradius are x and y radius of ellipse respectively.

 main()  {  int gd = DETECT, gm;  initgraph(&gd, &gm, "C:\\TC\\BGI");  fillellipse(100, 100, 50, 25);  getch();  }

 outtext function displays text at current position.  Declaration :- void outtext(char *string);

 main()  {  int gd = DETECT, gm;  initgraph(&gd, &gm, "C:\\TC\\BGI");  Outtext(“HELLO WORLD”);  getch();  }

 outtextxy function display text or string at a specified point(x,y) on the screen.  Declaration :- void outtextxy(int x, int y, char *string);  x, y are coordinates of the point and third argument contains the address of string to be displayed.

 main()  {  int gd = DETECT, gm;  initgraph(&gd, &gm, "C:\\TC\\BGI");  Outtextxy(250,350,“HELLO WORLD”);  getch();  }

 Declaration :- void setbkcolor(int color);  setbkcolor function changes current background color  e.g. setbkcolor(YELLLOW) changes the current background color to YELLOW.  Remember that default drawing color is WHITE and background color is BLACK.

 main()  {  int gd = DETECT, gm;  initgraph(&gd, &gm, "C:\\TC\\BGI");  Setbkcolor(3);  Outtextxy(250,350,“HELLO WORLD”);  getch();  }

 Declaration :- void setcolor(int color);  In Turbo Graphics each color is assigned a number. Total 16 colors are available. Strictly speaking number of available colors depends on current graphics mode and driver.For Example :- BLACK is assigned 0, RED is assigned 4 etc.  setcolor function is used to change the current drawing color.e.g. setcolor(RED) or setcolor(4) changes the current drawing color to RED. Remember that default drawing color is WHITE.

 main()  {  int gd = DETECT, gm; initgraph(&gd,&gm,"C:\\TC\\BGI");  circle(100,100,50); /* drawn in white color */  setcolor(RED);  circle(200,200,50); /* drawn in red color */  getch();  }

 Declaration :- void setfillstyle( int pattern, int color);  Different fill styles:  enum fill_styles  {  EMPTY_FILL,  SOLID_FILL,  LINE_FILL,  LTSLASH_FILL,  SLASH_FILL,  BKSLASH_FILL,  LTBKSLASH_FILL,  HATCH_FILL,  XHATCH_FILL,  INTERLEAVE_FILL,  WIDE_DOT_FILL,  CLOSE_DOT_FILL,  USER_FILL  };

 main()  {  int gd = DETECT, gm;  initgraph(&gd, &gm, "C:\\TC\\BGI");  setfillstyle(XHATCH_FILL, RED);  circle(100, 100, 50);  floodfill(100, 100, WHITE);  getch();  }

 Settextstyle function is used to change the way in which text appears, using it we can modify the size of text, change direction of text and change the font of text.  Declaration :- void settextstyle( int font, int direction, int charsize);  font argument specifies the font of text, Direction can be HORIZ_DIR (Left to right) or VERT_DIR (Bottom to top).

 enum font_names  {  DEFAULT_FONT,  TRIPLEX_FONT,  SMALL_FONT,  SANS_SERIF_FONT,  GOTHIC_FONT,  SCRIPT_FONT,  SIMPLEX_FONT,  TRIPLEX_SCR_FONT,  COMPLEX_FONT,  EUROPEAN_FONT,  BOLD_FONT  };

 main()  {  int gd = DETECT, gm, x = 25, y = 25, font = 0;  initgraph(&gd,&gm,"C:\\TC\\BGI");  for ( font = 0 ; font <= 10 ; font++)  {  settextstyle(font, HORIZ_DIR, 1);  outtextxy(x, y, "Text with different fonts");  y = y + 25;  }  getch();  }

 void main()  {  int gd=DETECT,gm;  initgraph(&gd,&gm,"c:\\TurboC3\\bgi");  setbkcolor(3);  setcolor(4);  line(100,400,300,400);  line(100,400,100,200);  line(300,400,300,200);  line(100,200,200,100);  line(200,100,300,200);  line(150,400,150,300);  line(250,400,250,300);  line(150,300,250,300);  circle(200,200,40);  getch();  }

 void main()  {  int gd=DETECT,gm;  initgraph(&gd,&gm,"c:\\TurboC3\\bgi");  line(150,475,520,475);  arc(330,475,0,180,50);  line(330,428,330,320);  line(370,445,440,390);  getch();  }