 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Pedro Alves Guest
|
Posted: Tue Nov 23, 2004 2:31 pm Post subject: Using scanline to fill an array [][] |
|
|
Hi,
I'm trying to use scanline with a bitmap picture in order to fill and
array[][] of the size of the picture with all its information (pixel
data).
For that I:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
<<< setting up calculations and files to receive those
calculations
bitmap1 = new Graphics::TBitmap();
bitmap1->LoadFromFile(FileListBox1->FileName);
Image1->Canvas->Draw(0,0,bitmap1);
bitmap1->PixelFormat = pf8bit;
m = bitmap1->Height; //rows y m j
n = bitmap1->Width; //cols x n k
float **data; // Original image pixels
try {
data = new float*[m];
for (int j = 0; j < m; j++)
data[j] = new float[n];
}
catch(...) {
ShowMessage("Could not allocate for data[][]. Bye for now!");
exit(-1);
};
With this array data, I use scanline and two for cycles (the usual) to
go through each element and keep it in data[m][n]
What happens is that I can do this with a 256x256 pixels picture but
not with a 100x100 or a rectangle picture.
I think I'm getting very confused and I might have some other errors
on my code.
Is there and easier way to:
1) create a array the size of the picture (using the operator new
making it width and height independent)?
2) Use scanline to go through the picture and save it the array?
I'm a newbie on this.
Thanks for the help.
Pedro
[email]alves_pmf (AT) yahoo (DOT) com.br[/email]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|