TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ALL
from: KNUT SCHUENEMANN
date: 1997-10-16 02:21:00
subject: C++Builder & Pixels

I've got a question about the following code...;
...I'm sorry about it's length, but I can only guess where the bug might be:
//--------------------------------------------------------------------
TImageTool *ImageTool;
struct PictureData
  { Graphics::TBitmap *Bmp; TChild *Win; }
  PictureList[12] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
                     {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}};
TChild *ActiveChild, *CopiedPicture;
Graphics::TBitmap *ActiveBitmap, *CopiedBitmap;
short NumberOfPictures = 0;
short LastUsed = 0;
//---------------------------------------------------------------------------
void __fastcall TImageTool::FileOpenClick(TObject *Sender)
{
 if (OpenDialog->Execute())
  {
   if (NumberOfPictures < 12)
   {
    Graphics::TBitmap *Bmp;
    Bmp = new Graphics::TBitmap;
    Image->Picture->LoadFromFile(OpenDialog->FileName);
    Bmp->Assign(Image->Picture->Bitmap);
    TChild* child = new TChild(this);
    PictureList[NumberOfPictures].Win = child;
    PictureList[NumberOfPictures++].Bmp = Bmp;
    child->Image->Picture->Assign(Bmp);
    child->ClientWidth = Bmp->Width;
    child->ClientHeight = Bmp->Height;
    child->Caption = OpenDialog->FileName;
    child->Show();
    ActiveChild = child;
    ActiveBitmap = Bmp;
   }
  }
}
//---------------------------------------------------------------------------
void __fastcall TImageTool::Kopie1Click(TObject *Sender)
{
 if (MDIChildCount <12)
 {
  ActiveChild = (TChild*)ActiveMDIChild;
  TChild* child = new TChild(this);
  child->Image->Picture->Assign(ActiveBitmap);
  child->ClientWidth = ActiveBitmap->Width;
  child->ClientHeight = ActiveBitmap->Height;
  child->Caption = ("Copy of " + ActiveChild->Caption);
  child->Show();
  PictureList[NumberOfPictures].Win = child;
  PictureList[NumberOfPictures++].Bmp = ActiveBitmap;
  CopiedBitmap = new Graphics::TBitmap;
  CopiedBitmap->Assign(ActiveBitmap);
  CopiedPicture = child;
 }
}
//---------------------------------------------------------------------------
void __fastcall TImageTool::VSobelClick(TObject *Sender)
{
  int hMax, vMax;
  long Factor;
  TColor Color;
  Graphics::TBitmap* Source;
  Graphics::TBitmap* Target;
  Source = ActiveBitmap;
  vMax = Source->Height;
  hMax = Source->Width;
  Kopie1Click(Sender);
  Target = CopiedBitmap;
  CopiedPicture->Caption = ("modified " + CopiedPicture->Caption);
  for (int y=1; yCanvas->Pixels[x+i][y+j])));
          }
        }
        if ((long)Color > 0x00FFFFFF) Color = (TColor)0x00FFFFFF;
        if ((long)Color < 0x00000000) Color = (TColor)0x00000000;
        Target->Canvas->Pixels[x][y] = Color;
       }
     }
     // CopiedPicture->Update();
     // CopiedPicture->Refresh();
     // CopiedPicture->Invalidate();
 }
//---------------------------------------------------------------------------
The image get's loaded and displayed (and even correctly duplicated) but
the VSobel-Function first displays a correctly sized but empty window,
then, after some time calculating, displays the _original_ image once
again.
The commented members don't change anything.
How can I get the application to display the modified image on screen???
Knut
 * End of forwarded message
--- Yuppie v2.11
---------------
* Origin: The Stoned Ghost (2:2437/120.5)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.