J
JoeC
I am writing a program to display bitmaps and I want to use a vector
to hold my bitmap data but when I use this algorithm it fails:
for(index = 0; index < dwn; index++){
memcpy(&temp[((dwn-1) - index)*acc],
&bitData[index*acc],acc);}
The vector is declared in the header and in the constuctor I fill it
with zeros as a default.
Size is = acc*dwn;
Default 16*16 bitmap;
for(int lp = 0; lp != size; lp++){
bitData.push_back(0);
}
If I add this the program does not crash:
BYTE* bitmap::flip(){
int acc = bmi.bmiHeader.biWidth;
int dwn = bmi.bmiHeader.biHeight;
int index;
BYTE *temp2 = new BYTE[bitData.size()];
for(int l=0; l < bitData.size();l++){
temp2[l]=bitData[l];
}
BYTE * temp = new BYTE[acc*dwn];
for(index = 0; index < dwn; index++){
memcpy(&temp[((dwn-1) - index)*acc],
&temp2[index*acc],acc);}
return temp;
}
I have written a bitmap before and used a vector to hold the graphics
data but this object trying to do a DIB bitmap is giving me all kinds
of problems. The algorithm works in a function but when I try to put
the same information in an object it fails. Anything else I can add
to help explain the problem. I often have problems asking questions
on more complex problems because it can be cumbersome to post from
several files both .h and .cpp.
to hold my bitmap data but when I use this algorithm it fails:
for(index = 0; index < dwn; index++){
memcpy(&temp[((dwn-1) - index)*acc],
&bitData[index*acc],acc);}
The vector is declared in the header and in the constuctor I fill it
with zeros as a default.
Size is = acc*dwn;
Default 16*16 bitmap;
for(int lp = 0; lp != size; lp++){
bitData.push_back(0);
}
If I add this the program does not crash:
BYTE* bitmap::flip(){
int acc = bmi.bmiHeader.biWidth;
int dwn = bmi.bmiHeader.biHeight;
int index;
BYTE *temp2 = new BYTE[bitData.size()];
for(int l=0; l < bitData.size();l++){
temp2[l]=bitData[l];
}
BYTE * temp = new BYTE[acc*dwn];
for(index = 0; index < dwn; index++){
memcpy(&temp[((dwn-1) - index)*acc],
&temp2[index*acc],acc);}
return temp;
}
I have written a bitmap before and used a vector to hold the graphics
data but this object trying to do a DIB bitmap is giving me all kinds
of problems. The algorithm works in a function but when I try to put
the same information in an object it fails. Anything else I can add
to help explain the problem. I often have problems asking questions
on more complex problems because it can be cumbersome to post from
several files both .h and .cpp.