1 / 8

CSC 160 Computer Programming for Non-Majors Lecture #3c: Working with Pictures (continued)

CSC 160 Computer Programming for Non-Majors Lecture #3c: Working with Pictures (continued). Prof. Adam M. Wittenstein Wittenstein@adelphi.edu http://www.adelphi.edu/~wittensa/csc160/. A preview of today….

cowgill
Télécharger la présentation

CSC 160 Computer Programming for Non-Majors Lecture #3c: Working with Pictures (continued)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSC 160Computer Programmingfor Non-MajorsLecture #3c: Working with Pictures (continued) Prof. Adam M. Wittenstein Wittenstein@adelphi.edu http://www.adelphi.edu/~wittensa/csc160/

  2. A preview of today… • As a review of our first language rule (calling functions), we will look at some predefined functions from the “world.ss” teachpack. • Then we will learn our second language rule, which is defining a variable.

  3. I. The “world.ss” teachpack

  4. Some “world.ss” functions Here are some functions to create shapes. --Wherever a function takes in a "mode", you may use either the symbol 'solid or the symbol 'outline. --Wherever a function takes in an “image-color”, you can enter a color with a string or a symbol. For example, ‘blue or ‘Blue or “blue” or “Blue”. • rectangle num num mode image-color -> image • circle num mode image-color -> image • triangle num mode image-color -> image (NOTE: The triangle function is only for equilateral triangles.)

  5. Exercise 1: Creating shapes Using the function rectangle. • Have DrScheme draw a solid red rectangle that is 50 by 100. Using the function circle. • Have DrScheme draw a solid red circle with a radius of 5. Using the function triangle. • Have DrScheme draw an outline of an green equilateral triangle with sides of 50 pixels each.

  6. More “world.ss” functions • image-width: image -> number • image-height: image -> number • overlay: image image ... -> image

  7. Exercise 2: More Image Functions • Find the width and height of one of the shapes from Exercise 1. • Find the width and height of a picture from your computer or a website. • Put a solid red circle with a radius of 5 on top of this picture.

  8. In summary… We have called (predefined) functions involving each of these data types: • Mathematical: numbers, booleans • Linguistic: words (a.k.a. symbols), sentences (a.k.a. strings) • Images: pictures, shapes -- Next class, we will see how to define variables and functions.

More Related