Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSC 160 Computer Programming for Non-Majors Lecture #3c: Working with Pictures (continued) Prof. Adam M. Wittenstein

Similar presentations


Presentation on theme: "CSC 160 Computer Programming for Non-Majors Lecture #3c: Working with Pictures (continued) Prof. Adam M. Wittenstein"— Presentation transcript:

1 CSC 160 Computer Programming for Non-Majors Lecture #3c: Working with Pictures (continued) Prof. Adam M. Wittenstein Wittenstein@adelphi.eduhttp://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. 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. 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. 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 one of the shapes from Exercise 1. Find the width and height of a picture from your computer or a website. 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. 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.


Download ppt "CSC 160 Computer Programming for Non-Majors Lecture #3c: Working with Pictures (continued) Prof. Adam M. Wittenstein"

Similar presentations


Ads by Google