Comments on Week of 24 Jan 2005
Sorry! I'm late for updating this week!
- How's the pace going in class? Too slow? Too fast? Or perhaps "Baby Bear"?
- Is it easier to collage in Java or Python?
- What's the worst thing about the class so far? What's the best?
Comments? Questions!
/**
* Crop the picture from (x1,y1) to (x2,y2)
**/
public Picture crop(int x1, int y1, int x2, int y2)
{
Pixel currPixel;
Picture target = new Picture((x2-x1),(y2-y1));
for (int srcx = x1, trgx = 0; srcx < x2; srcx++, trgx++)
{
for (int srcy = y1, trgy = 0; srcy < y2; srcy++, trgy++)
{
// get the current pixel
currPixel = this.getPixel(srcx,srcy);
/* copy the color of currPixel into target
*/
target.getPixel(trgx,trgy).setColor(currPixel.getColor());
}
};
return target;
}
Mama Bear?? I think the pace is good thus far...
Baby Bear's, not Mama Bear. Sorry! Wrong reference. Baby bear's chair, porridge, and bed were "just right." Mark Guzdial |
Link to this Page