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
 ImageEnMView with Thumbnail previews?

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
lcd877 Posted - Nov 27 2012 : 02:59:20
I am creating a simple slide viewer with an ImageEnMView for showing the selected image in large size and another ImageEnMView which displays thumbnails of all images in a directory (ImageEnMView is used for the large picture so that we can display transitions when switching between slides).

Currently both controls load their images directly from the directory, which means each image file is loaded twice... This works but is not efficient.

Is there a good way to share the images between the two controls?

Thanks,
Alexander

1   L A T E S T    R E P L I E S    (Newest First)
w2m Posted - Nov 28 2012 : 06:46:24
As far as I know, there is no way to get the original bitmap directly from ImageEnMView when the StoreType property is set to ietThumb. You can load the original bitmap from the file by getting the filename from ImageEnMView and loading it into ImageEnView however:

procedure TForm1.ImageEnMView1ImageSelect(Sender: TObject; idx: Integer);
begin
  // if StoreType = ietNormal get the bitmap from ImageEnMView else load the file
  if ImageEnMView1.StoreType = ietNormal then
  begin
     ImageEnView1.IEBitmap.Assign(ImageEnMView1.GetTIEBitmap(idx));
     ImageEnMView1.ReleaseBitmap(idx);
     ImageEnView1.IO.Params.Assign(ImageEnMView1.MIO.Params[idx]);
  end
  else
  begin    
    iFilename := ImageEnMView1.ImageFileName[idx];
    ImageEnView1.IO.LoadFromFile(iFilename);
  end;
  ImageEnView1.Update;
end;


This is not redundant because when the StoreType property is set to ietThumb, ImageEnMView only contains thumbnails of the original image so the only way to get the original image is to load it directly from a file.

You can move images from one ImageEnMView to another but if the source ImageEnView StoreType is ietThumb, then the destination ImageEnMView will contain thumbnails even if the destination StoreType is ietNormal. This is because ImageEnMView does not have anyway to store the full sized image as well as a thumbnail.

procedure TForm1.Button1Click(Sender: TObject);
// copy images from Source ImageEnMView to Destination ImageEnMView
// Note if source ImageEnMView contains only thumbnails the destination ImageEnMView will also contain thumbnails
var
  i: integer;
  iIEBitmap: TIEBitmap;
begin
  ImageEnMView2.Clear;
  ImageEnMView2.LockPaint;
  for i := 0 to ImageEnMView1.ImageCount - 1 do
  begin
    iIEBitmap := ImageEnMView1.GetTIEBitmap(i);
    ImageEnMView2.AppendImage;
    ImageEnMView2.SetIEBitmap(i, iIEBitmap);
    ImageEnMView1.ReleaseBitmap(i);
  end;
  ImageEnMView2.SelectedImage := 0;
  ImageEnMView2.UnLockPaint;
end;


If I were you I would just set the StoreType for both ImageEnMView to ietNormal which solves the problem because then you can get the original IEBitmap for the transition...

William Miller
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html