Graphics

Graphics - Revisiting acm.graphics collage model create...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Revisiting acm.graphics collage model – create image by adding objects to a canvas • Newer objects obscure those added earlier • Layering is called the stacking order (or z -order) Using portions of slides by Eric Roberts Structure of acm.graphics Package GObject GLabel GRect GOval GLine Using portions of slides by Eric Roberts Structure of acm.graphics Package GCanvas GPoint GDimension GRectangle GObject GCompound GMath GLabel GRect GOval GLine GArc GImage GPolygon GRoundRect G3DRect Interfaces: GFillable GResizable GScalable GContainer Using portions of slides by Eric Roberts Structure of acm.graphics Package GCanvas GPoint GDimension GRectangle GObject GCompound GMath GLabel GRect GOval GLine GArc GImage GPolygon GRoundRect G3DRect Interfaces: GFillable GResizable GScalable GContainer Using portions of slides by Eric Roberts • Used to represent background canvas of collage GraphicsProgram automatically creates GCanvas that fills the entire program window • When you call add(…) in GraphicsProgram , it is forwarding your call to the GCanvas – Forwarding is just when receiver of message then calls some other object with that same message GCanvas Using portions of slides by Eric Roberts Methods in GCanvas and GraphicsProgram The following methods are available in both the GCanvas and GraphicsProgram classes: Adds the object to the canvas at the front of the stack Moves the object to ( x , y ) and then adds it to the canvas Removes the object from the canvas Removes all objects from the canvas Returns the frontmost GObject at ( x , y ), or null if none Returns the width in pixels of the entire canvas Returns the height in pixels of the entire canvas Sets the background color of the canvas to c. add( object ) add( object , x , y ) remove( object ) removeAll() getElementAt( x , y ) getWidth() getHeight() setBackground( c ) Pauses the program for the specified time in milliseconds Suspends the program until the user clicks the mouse pause( milliseconds ) waitForClick() The following methods are available in GraphicsProgram only: Using portions of slides by Eric Roberts
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Class hierarchy of GObject GObject GCompound GLabel GRect GOval GLine GArc GImage
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/25/2010 for the course CS 106A taught by Professor Sahami,m during the Fall '08 term at Stanford.

Page1 / 4

Graphics - Revisiting acm.graphics collage model create...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online