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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Best method to add image to ImageEnMView

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
chambers120 Posted - Apr 17 2015 : 07:00:32
I'm acquiring an image from a scanner and displaying in the
ImageEnView component. I also want to add the acquired image to the ImageEnMView component.

This code works but...
//Add Acquire Image to TImageEnMView
//Probably better method of moving image to ImageEnMView?
if cbAcqImagEnM.Checked=True then //Checkbox to allow adding image
begin
BMP:=TBitmap.Create;
BMP.Assign(ImageEnView1.Bitmap);
S:=GetTmpInternetDir; //Temporary internet file directory Win7
BMP.SaveToFile(S+'!Tmp.bmp');
ImageEnMView1.MIO.LoadFromFile(S+'!Tmp.bmp');
BMP.Free;
DeleteFile(S+'!Tmp.bmp');
end;

What is a better method to accomplish this?
Thanks as always,
Charlie Chambers
2   L A T E S T    R E P L I E S    (Newest First)
chambers120 Posted - Apr 17 2015 : 11:57:17
Thank you Bill - Just what I was wanting.
All my best,
Charlie
w2m Posted - Apr 17 2015 : 08:18:43
There are a number of ways to do this. Here is one way:
Copy TIEBitmap from TImageEnView To TImageEnMView

  { AppendImage appends a new image at last position
  in the list and returns the new image position (SelectedImage). }
  ImageEnMView1.AppendImage;
  if ImageEnMView1.SelectedImage <> -1 then
  begin
    { Set the ImageEnView image to the ImageEnMView SelectedImage. }
    ImageEnMView1.SetIEBitmap(ImageEnMView1.SelectedImage,
    ImageEnView1.IEBitmap);
    { Whenever an image (Bitmap) within a TImageEnMView changes, you
    must update the thumbnail with TImageEnMView.UpdateImage to make
    sure the thumbnail is visible. }
    ImageEnMView1.UpdateImage(ImageEnMView1.SelectedImage);
    { Assign the ImageEnView.IO.Params to the ImageEnMView.MIO.Params
    incase the params are needed.  Assign does not assign the IO
    params because the image is copied from memory. }
    ImageEnMView1.MIO.Params[ImageEnMView1.SelectedImage].Assign(ImageEnView1.IO.Params);
    { Update the display to show the current content and properties. }
    ImageEnMView1.Update;
  end;

You could also scan the image into TImageEnMView directly then copy the thumbnail to TImageEnView with GetIEBitmap:
Copy the selected TIEBitmap from TImageEnMView to TImageEnView
{ Create a TIEBitmap object from the image at index. }
try
  ImageEnView1.IEBitmap.Assign
  (ImageEnMView1.GetTIEBitmap(ImageEnMView1.SelectedImage));
finally
  { Release or Free the TIEBitmap }
  ImageEnMView1.ReleaseBitmap(ImageEnMView1.SelectedImage);
end;
ImageEnView1.IO.Params.Assign(ImageEnMView1.MIO.Params
  [ImageEnMView1.SelectedImage]);
ImageEnView1.Update;

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development