Help! Figure out whats wrong! FOR LOOP-ing!
-
hello all.. i need some help to solve my problem.. i'd tried so many times to test this program... it works very well if i did not include the FOR LOOP into my program. i hope you guys can have a look at my program and figure out what mistakes i did..thanks.. COLORREF OriginalPixelValue; COLORREF NewPixelValuesss; int PixelCount=0; CoX=0; //coordinate-X CoY=0; //coordinate-Y for(int abcde=0; abcde<48; abcde++) { OriginalPixelValue=PixelValue(CoX,CoY); NewPixelValuesss=(OriginalPixelValue | Data_0[PixelCount]) & Data_1[PixelCount]; GoWatermark(NewPixelValuesss,CoX,CoY); PixelCount+=1; if(CoX} COLORREF CThongThongThongDlg::PixelValue(unsigned int cox, unsigned int coy) { m_pixelvalue=GetPixel(m_dcMem1, cox, coy); return m_pixelvalue; } BOOL CThongThongThongDlg::GoWatermark(unsigned long ValueValue, int CoordinateX, int CoordinateY) { NewSettedPixelValue=m_dcMem1.SetPixel(CoordinateX, CoordinateY, ValueValue); UpdateData(FALSE); return TRUE; } please take note at those lines in [B]BOLD[/B] .. when i put in this lines..to loop... the function does go..(i mean..the results i got is nothing...not working).. but if i delete those lines(those loops)..the function will run properly.. i really need to loop..its very important.. this is a school project.. where i need to read the bits values inside the 24-bit BITMAPS and do some modification of its RGB LSB.. i really need help. thanks a lot. thong twh81@tm.net.my ...
-
hello all.. i need some help to solve my problem.. i'd tried so many times to test this program... it works very well if i did not include the FOR LOOP into my program. i hope you guys can have a look at my program and figure out what mistakes i did..thanks.. COLORREF OriginalPixelValue; COLORREF NewPixelValuesss; int PixelCount=0; CoX=0; //coordinate-X CoY=0; //coordinate-Y for(int abcde=0; abcde<48; abcde++) { OriginalPixelValue=PixelValue(CoX,CoY); NewPixelValuesss=(OriginalPixelValue | Data_0[PixelCount]) & Data_1[PixelCount]; GoWatermark(NewPixelValuesss,CoX,CoY); PixelCount+=1; if(CoX} COLORREF CThongThongThongDlg::PixelValue(unsigned int cox, unsigned int coy) { m_pixelvalue=GetPixel(m_dcMem1, cox, coy); return m_pixelvalue; } BOOL CThongThongThongDlg::GoWatermark(unsigned long ValueValue, int CoordinateX, int CoordinateY) { NewSettedPixelValue=m_dcMem1.SetPixel(CoordinateX, CoordinateY, ValueValue); UpdateData(FALSE); return TRUE; } please take note at those lines in [B]BOLD[/B] .. when i put in this lines..to loop... the function does go..(i mean..the results i got is nothing...not working).. but if i delete those lines(those loops)..the function will run properly.. i really need to loop..its very important.. this is a school project.. where i need to read the bits values inside the 24-bit BITMAPS and do some modification of its RGB LSB.. i really need help. thanks a lot. thong twh81@tm.net.my ...
Is this a "deliberate" typo?
if(CoX { CoX+=1; }
Shouldn't it beif(CoX) { Cox += 1; } else { CoY+=1; CoX=0; }
It is amazing what you can accomplish if you do not care who gets the credit. - Harry S Truman
-
Is this a "deliberate" typo?
if(CoX { CoX+=1; }
Shouldn't it beif(CoX) { Cox += 1; } else { CoY+=1; CoX=0; }
It is amazing what you can accomplish if you do not care who gets the credit. - Harry S Truman
His code is actually:
if(CoX < m_bmInfo1.bmWidth)
{
CoX+=1;
}
else
{
CoY+=1;
CoX=0;
} -
hello all.. i need some help to solve my problem.. i'd tried so many times to test this program... it works very well if i did not include the FOR LOOP into my program. i hope you guys can have a look at my program and figure out what mistakes i did..thanks.. COLORREF OriginalPixelValue; COLORREF NewPixelValuesss; int PixelCount=0; CoX=0; //coordinate-X CoY=0; //coordinate-Y for(int abcde=0; abcde<48; abcde++) { OriginalPixelValue=PixelValue(CoX,CoY); NewPixelValuesss=(OriginalPixelValue | Data_0[PixelCount]) & Data_1[PixelCount]; GoWatermark(NewPixelValuesss,CoX,CoY); PixelCount+=1; if(CoX} COLORREF CThongThongThongDlg::PixelValue(unsigned int cox, unsigned int coy) { m_pixelvalue=GetPixel(m_dcMem1, cox, coy); return m_pixelvalue; } BOOL CThongThongThongDlg::GoWatermark(unsigned long ValueValue, int CoordinateX, int CoordinateY) { NewSettedPixelValue=m_dcMem1.SetPixel(CoordinateX, CoordinateY, ValueValue); UpdateData(FALSE); return TRUE; } please take note at those lines in [B]BOLD[/B] .. when i put in this lines..to loop... the function does go..(i mean..the results i got is nothing...not working).. but if i delete those lines(those loops)..the function will run properly.. i really need to loop..its very important.. this is a school project.. where i need to read the bits values inside the 24-bit BITMAPS and do some modification of its RGB LSB.. i really need help. thanks a lot. thong twh81@tm.net.my ...
I can see two things that the
for
loop might affect. 1) the incrementing ofPixelCount
. This is used in the dereferencing ofData_0
andData_1
. Are the arrays large enough? 2) the incrementing ofCoX
andCoY
. Those are used byPixelValue()
andGoWatermark()
. Can those functions handle values greater than 0? -
His code is actually:
if(CoX < m_bmInfo1.bmWidth)
{
CoX+=1;
}
else
{
CoY+=1;
CoX=0;
}Thanks, that is not what I see on IE6! Perhaps he could give a link to the source code? I could not see anything obviously wrong. But it could have been screwed durin cut/paste.
It is amazing what you can accomplish if you do not care who gets the credit. - Harry S Truman
-
Thanks, that is not what I see on IE6! Perhaps he could give a link to the source code? I could not see anything obviously wrong. But it could have been screwed durin cut/paste.
It is amazing what you can accomplish if you do not care who gets the credit. - Harry S Truman
I don't see it either. Looks like IE6 swallowed the "<" as an HTML tag. He needs to wrap his sample code with tags.