CS 102 Computers In Context (Multimedia) 03 / 20 / 2009 Instructor: Michael Eckmann
Michael Eckmann - Skidmore College - CS Spring 2009 Today’s Topics Questions/comments? Chapter 5 –Drawing with drawing commands –Drawing our own pictures
Michael Eckmann - Skidmore College - CS Spring 2009 Drawing commands JES provides the following functions for drawing on a picture: –addText(pic, x, y, text) pic is a picture object x and y are integers text is a string Puts the text on the picture starting at the pixel at x,y –addLine(pic, x1, y1, x2, y2) Draws a line on the pic from x1,y1 to x2, y2 –addRect(pic, x, y, w, h) Draws a rectangle with upper-left corner at x,y with a width of w and height of h –addRectFilled(pic, x, y, w, h, color) --- guess what this does Let's try some of these now
Michael Eckmann - Skidmore College - CS Spring 2009 Drawing our own pictures Let's try to draw a square picture that contains non-filled squares inside each other separated by 2 pixels. How might we go about this?
Michael Eckmann - Skidmore College - CS Spring 2009 Drawing our own pictures Let's look at the greyeffect.jpg picture from our text and see if we can write a program to create it.