Thanks for your reply. So basically I have an image 'Airplane.png' which is displayed as normal when the above program is ran.
I have only written >borderedImage(PixelGrid) as preparation for the code to add a border, so it is not in ImageHandle.h or anything. I haven't added any code yet to add a border as I don't know where to start for it.
I would like to add a border round the image 3 pixels wide, making the image taller and wider.
Thanks in advance.
(Please disregard lines 25-34 of code as I don't actually need them and forgot to remove them for original post, which basically leaves the code saying 'add a border to the image and save this new image as BorderedAirplane.png' - obviously the only part missing now is the code to actually add the border to the image.
// How wide you want the border
constint BORDER_WIDTH = 3;
// A grid able to hold existing grid with a border
unsigned PixelGridWithBorder[WIDTH+BORDER_WIDTH*2][HEIGHT+BORDER_WIDTH*2];
// Create the new image
borderedImage(PixelGrid,PixelGridWithBorder);
Though I suspect you've got width/height the wrong way round in the array definition.
One would normally expect unsigned PixelGrid[HEIGHT][WIDTH]; as pixels are usually stored in row order.
the sides wrap around if you set it up the right way. eg, say you wanted to do 3 pixel boarder, then you write the last 3 on a row and the next 3 of the next row are sequential in memory, so you can do them all at once rather than do like a left side loop and a right side loop. Top and bottom are sometimes doable with block memory functions, depending on how the data is set up. Lines across are full blocks; 3 lines is one continuous pointer in other words. So the whole thing can be done with 2 block memory statements for top and bottom and one loop to do both sides, if you want to compact it for efficiency and code simplification.
the above is more suitable if you want to change the edge pixels into a boarder, instead of increase the image size.
to increase its size, make a new image and flood fill it to the boarder color first.
then copy the old image, line by line with the block copy (eg memcpy) type operations at the correct starting row.
if this is a class object with a constructor, it is missing a type.
if it is a function call, you can't do that outside of main (or more precisely outside of code blocks like any function).