Question: Create a Picture class that contains: 1 . a private vector of Pixel structures. 2 . a private integer representing the width of the picture.
Create a Picture class that contains:
a private vector of Pixel structures.
a private integer representing the width of the picture.
a private integer representing the height of the picture.
a private integer representing the maximum intensity of each pixel color.
a public constructor that takes no arguments. This constructor will set the width, height, and maximum intensity to
a public accessor called getpixel. This function will take a row and a column as integer values, and it will return the given Pixel at the row and column byconstantreference. You may assume that the row and column will exist. Remember, the private vector stores all pixel values in one dimension. This means that you'll need a little bit of math to figure out where the pixel begins. For this, remember that each row contains a number of pixels, which is equal to the number of columns. For example, a file that has a width of and a height of has columns and rows. This means that row starts at vector.at and row starts at vector.attotalnumberofcolumns and row starts at vector.attotalnumberofcolumns ;
a public mutator also called getpixel. This function is exactly like the accessor getpixel, except it is a mutator, and allows for you to write setpixel by returning a mutable reference to a pixel.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
