Image.cpp - Project UID #include <cassert>#include\"Image.h REQUIRES img points to an Image 0 < width width <= MAX_MATRIX_WIDTH 0 < height height <=

Image.cpp - Project UID #include <cassert>#include"Image.h...

This preview shows page 1 - 2 out of 2 pages.

// Project UID af1f95f547e44c8ea88730dfb185559d #include <cassert> #include "Image.h" // REQUIRES: img points to an Image // 0 < width && width <= MAX_MATRIX_WIDTH // 0 < height && height <= MAX_MATRIX_HEIGHT // MODIFIES: *img // EFFECTS: Initializes the Image with the given width and height. // NOTE: Do NOT use new or delete here. void Image_init(Image* img, int width, int height) { img->width = width; img->height = height; Matrix_init(&img->red_channel,width,height); Matrix_init(&img->green_channel,width,height); Matrix_init(&img->blue_channel,width,height); } // REQUIRES: img points to an Image // is contains an image in PPM format without comments // (any kind of whitespace is ok) // MODIFIES: *img // EFFECTS: Initializes the Image by reading in an image in PPM format // from the given input stream. // NOTE: See the project spec for a discussion of PPM format. // NOTE: Do NOT use new or delete here. void Image_init(Image* img, std::istream& is) { std::string whitespace = ""; is >> whitespace >> img->width >> img->height >> whitespace; Matrix_init(&img->red_channel,img->width,img->height);

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture