Okay... follow along closely.
I am using a 2D to 3D Phong Filter on my image (Lainz provided the code that did the phong)
I have a "Design" window (using notebook) where the phong works fine.
When I click an "Export" button I assign the entire bitmap into a "new3D" Bitmap... that works fine.
After the "Export" window displays I have two choices of resizing. 1) Original Size and 2) Custom Size
The Original Size works fine... The "new3D" bitmap fills the BGRAGraphicControl perfectly.
FYI... the Export just brings me to an Export window.
However, when I click the "Custom Size", the control changes to the correct size, but the "new3D" image resizes, but it is way to small and doesn't fit the control.
I doubled checked my code to make sure I am getting the original size bitmap and I am.
So, I am not sure what is happening. Maybe another set of eyes can see something I am not.
Here is my Export button code that sets the Phong image from the Control on the Design window
And just so you know, the original is the size of the control you see in screenshot below.
procedure TForm1.mnuExportImgClick(Sender: TObject);
begin
nb.PageIndex:=2;
BGRAGraphicControl2.DiscardBitmap;
{reldaw current bitmap}
theBMP:= TBGRABitmap.Create(txtImpImg.Text);
BGRAGraphicControl2.Width:=theBMP.width;
BGRAGraphicControl2.Height:=theBMP.height;
Image2.Width:=theBMP.width;
Image2.Height:=theBMP.height;
newBMP:= TBGRABitmap.Create(theBMP.Bitmap);
newBMP.PutImage(0, 0, theBMP, dmDrawWithTransparency );
bmp := TBGRABitmap.Create(theBMP);
new3D:= TBGRABitmap.Create(BGRAGraphicControl1.Bitmap); //<-- THIS IS WHERE I FETCH THE BITMAP OFF THE DESIGN WINDOW
// THIS WORKS FINE
This is my code that draws the "new3D" bitmap
This works fine too
procedure TForm1.BGRAGraphicControl2Redraw(Sender: TObject; Bitmap: TBGRABitmap
);
begin
BGRAGraphicControl2.Bitmap.Assign(new3D);
end;
Here is the code that does the custom Resizing
This code doesn't work right
procedure TForm1.opt5Change(Sender: TObject);
begin
BGRAGraphicControl2.DiscardBitmap;
//resize visual controls
Image2.Width:=StrToInt(Edit1.Text);
Image2.Height:=StrToInt(Edit2.Text);
BGRAGraphicControl2.width:=StrToInt(Edit1.Text);
BGRAGraphicControl2.Height:=StrToInt(Edit2.Text);
//resize bitmap
newBMP:= TBGRABitmap.Create(BGRAGraphicControl1.Bitmap); //<-- I GET THE ORIGINAL BITMAP - THIS WORKS
newBMP.ResampleFilter:= rfBestQuality;
BGRAReplace(newBMP, newBMP.Resample(StrToInt(Edit1.Text), StrToInt(Edit2.Text)));
new3D.Assign(newBMP);
end;
Attached is a screenshot of the small bitmap that should be filling the control