cyprus106
Programmer
- Apr 30, 2001
- 654
I've got 2 questions, actually...
The first:
the code below is supposed to invert the colors of an entire image. Unfortunately, it usually only inverts about 1/3 of the way over and then stops. I think the only time it totally inverts is on a 256x256 image. I'm almost positive this occurs because when the width is larger than the height. I think it stops because it only scanlines as far as the height and the width statement is inside of that so thats when it stops. But I've tried all sizes of images and its always the same thing. I think it would probably be best if you copied and pasted the code and looked for yourself. It's confusing to explain.
int x, y;
BYTE* LinePtr;
/* inversion */
for (y = 0; y < Image1->Height; y++)
{
LinePtr = (BYTE*)Image1->Picture->Bitmap->ScanLine[y];
for (x = 0; x < Image1->Width; x++)
LinePtr[x] = 255 - LinePtr[x];
}
Image1->Refresh();
I hope someone who knows more about math and logic than me can work this out. I KNOW it's got to be something simple but I'm out of options.
The second question>
Does anybody have any good websites on advanced image topics and BCB? Any image topics for that matter...
Thanks, Cyprus
The first:
the code below is supposed to invert the colors of an entire image. Unfortunately, it usually only inverts about 1/3 of the way over and then stops. I think the only time it totally inverts is on a 256x256 image. I'm almost positive this occurs because when the width is larger than the height. I think it stops because it only scanlines as far as the height and the width statement is inside of that so thats when it stops. But I've tried all sizes of images and its always the same thing. I think it would probably be best if you copied and pasted the code and looked for yourself. It's confusing to explain.
int x, y;
BYTE* LinePtr;
/* inversion */
for (y = 0; y < Image1->Height; y++)
{
LinePtr = (BYTE*)Image1->Picture->Bitmap->ScanLine[y];
for (x = 0; x < Image1->Width; x++)
LinePtr[x] = 255 - LinePtr[x];
}
Image1->Refresh();
I hope someone who knows more about math and logic than me can work this out. I KNOW it's got to be something simple but I'm out of options.
The second question>
Does anybody have any good websites on advanced image topics and BCB? Any image topics for that matter...
Thanks, Cyprus