ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Stretch image not working
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

jwest

Brazil
67 Posts

Posted - Mar 22 2018 :  11:04:07  Show Profile  Reply
Hi, I have a camera and I need to grab a frame to ImageEnView Control.

I have set autofit, autostretch and autoshrink to false in my target ImageEnView(to receive the copied frame).

But, After I copied the image from camera to ImageEnView Control the image
shows with scrollbar and much bigger than container dimensions.

If I grab the frame a second time, the image shows correctly without scrollbars and the stretch is ok.

How could I fix it?

var ImageEnViewFoto, ImageEnViewCamera:TImageEnView;
....
procedure TfrmFrameCliente.ImageEnViewCameraDShowNewFrame(Sender: TObject);
begin
// copy current sample to ImageEnView bitmap
ImageEnViewCamera.IO.DShowParams.GetSample(ImageEnViewCamera.IEBitmap);
ImageEnViewCamera.Stretch;
// refresh ImageEnView1
ImageEnViewCamera.Update;
end;

procedure TfrmFrameCliente.grabframe();
begin
ImageEnViewFoto.AutoFit:=false;
ImageEnViewFoto.AutoStretch:=false;
ImageEnViewFoto.AutoShrink:=false;
ImageEnViewFoto.IEBitmap.Assign(ImageEnViewCamera.IEBitmap);
ImageEnViewFoto.Stretch;
ImageEnViewFoto.Update;
end;

xequte

38222 Posts

Posted - Mar 22 2018 :  14:21:07  Show Profile  Reply
Hi

Stretch has no effect if the image is larger than the ImageEnView. I think Shrink is the method you want to use.



Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jwest

Brazil
67 Posts

Posted - Mar 22 2018 :  19:18:55  Show Profile  Reply
if I grab the frame two times all works well. Why?
How to do ImageEnView stretch works like TImage stretch?
Go to Top of Page

xequte

38222 Posts

Posted - Mar 22 2018 :  20:20:13  Show Profile  Reply
Hi

Do you mean that you want to stretch the image without painting the aspect ratio? (i.e. no border area even if the content is stretched unevenly).

You can do that as follows:

// Stretch without maintaining the aspect ratio
ImageEnView.GetIdealZoom( ZoomX, ZoomY );
ImageEnView.ZoomX := ZoomX;
ImageEnView.ZoomY := ZoomY;


Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: