> fout << pixel;
So, when did this lose the subscripts.
I'm saying this a lot at the moment, fix your indentation of the code - it's horrible to follow.
> fout << pixel;
So, when did this lose the subscripts.
I'm saying this a lot at the moment, fix your indentation of the code - it's horrible to follow.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Sorry about the messy code. I'm just trying so much stuff, and was planning on fixing the format once it was working. Should've made it tidy before posting, so apologies there. I tried creating a dynamic array but it's not working. The problem seems to be that once I've written to the file in my for loop, I can no longer access the pixels (or at least write to them again). I need to have the for loop in order to set the background to a colour otherwise the bitmap would just have the header and no image data.
edit: I've edited the original code to make it (slightly) more legible.
Thanks
I would have thought that this would keep the value of i constant. In turn, there should only be one pixel drawn. However, even though this is the only for loop in the program, it still makes the whole bitmap blue. This is probably why my pixels aren't drawing individually.
Code:for (int j=699); j >=0 ; j--){ for (int l=0; l<700; l++){ int i = 6; pixel[i + BLUE_OFF] = 0xFF; pixel[i + GREEN_OFF] = 0; pixel[i + RED_OFF] = 0; fout << pixel[i + BLUE_OFF] ; fout << pixel[i + GREEN_OFF]; fout << pixel[i + RED_OFF] ; } }
After days of head banging, I've fianlly managed to solve the problem. Thanks everyone for your help, I really appreciate it. Now to complete the main part of the project lol.
Thanks again.