![]() |
Scanline in Borland
In Borland C++
I have copied an Image1 to an array tab[x][y], now i wnant to copy pixels from that array to Image2 using ScanLine. I have used code: int tab[256][256], *LinePtr; void __fastcall TForm1::Button2Click(TObject *Sender) { for (int y=0; y<255; y++) { LinePtr = (BYTE *) Image2->Picture->Bitmap->ScanLine[y]; for (int x=0; x<255; x++) { LinePtr[x*3] = tab[x][y]; LinePtr[x*3+1] = tab[x][y]; LinePtr[x*3+2] = tab[x][y]; } } Image2->Refresh(); } But the image I have received is gray. The original one was colorful. How to use Scanline to receive original copied picture? |
You're putting the same pixel in three adjacent places. Presuming it's an RGB or BGR mapped image, that makes some shade of gray. Have a look at the forum's rules, please.
|
How should I change that??
|
Hard to say, since I don't know the format you're using. It's obvious at a glance, however, that one doesn't just replicate a pixel 3 times unless one is enlarging the image in a very rough way. It also looks strange that you're varying x more rapidly than y, since x is the major dimension in the array.
This response is based entirely on your code (which is hard to read, since you didn't use code tags). You have explained your goal and your resources in only the most cursory way and I'm not familiar with the Borland compiler/toolset. |
| All times are GMT -5. The time now is 1:39 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC