CSC151 2007S, Class 04: Raster Graphics Admin: * Assignments * I expect to read over HW1 tonight and HW2 tomorrow afternoon. * Assignment 3 is now available. * When working in groups, you need only submit one assignment per group. * Short reading on RGB colors for Thurday. * Extra Credit * Three extra credit talks on Thursday. * Cross-country's one Home meet on Saturday. Overview: * Representing images, revisited. * Pixels and colors: The basics. * The graphics coordinate system. * Key functions. * Lab a Working with this representation * Create a new image of specified width and height image.new * Open an existing image image.load * Get information about that image image.width image.height * Get and set pixels image.get-pixel image.set-pixel! * Observation: All of these operations have the same prefix "image." * Not required by the language * But imposed by programmer Some hints and corrections * To define the landscape image (define landscape (image.new 9 5)) * To set the background color (envt.set-bgcolor! (cname->rgb "yellow")) Expected lessons * How to use the basic operations * In an image of width w (9) and height h (5), the last column is w-1 (8) and the last row is h-1 (4) * If the last column is c and c is even, the center is c/2 * Naming is your friend (define color (cname->rgb "red")) * Sometimes you need to do a sequence of operations (define color (cname->rgb "red")) (image.set-pixel! landscape 0 0 color) * You can also using nesting to sequence (image.set-pixel! landscape 0 0 (cname->rgb "red")) Unexpected lessons * DrFu is not so reliable * Sam and Emily and Dr Davis don't always have the answers * It may be better to do everything in the interactions window (or in the definitions window, but not both)