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
 How to draw multiple images besides each other
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

exchangeviews

India
39 Posts

Posted - Jul 11 2015 :  05:52:12  Show Profile  Reply
Hello,

I am able to draw 2 images using following concept:
http://www.imageen.com/ieforum/topic.asp?TOPIC_ID=1530

But I need to draw multiple images of ImageEnMView besides each other. Looking for a way to combine each checked images only.

Any Idea?

Please assist.

Thanks in advance.

w2m

USA
1990 Posts

Posted - Jul 11 2015 :  09:56:04  Show Profile  Reply
Here is one way to draw checked images horizontally at a specified dimension.

uses imageenview, iemio, imageenproc, ieview, iemview, iexBitmaps, hyiedefs, hyieutils;
procedure TForm1.DrawHorzontally1Click(Sender: TObject);
var
  i: Integer;
  iIndex: Integer;
  iIEBitmapSource: TIEBitmap;
  iCheckedCounter: Integer;
  iBitmapSourceWidth: Integer;
  iBitmapSourceHeight: Integer;
begin
  Screen.Cursor := crHourGlass;
  try
    ImageEnView1.Clear;
    // Create a TIEbitmap to hold the source image
    iIEBitmapSource := TIEBitmap.Create;
    try
      iBitmapSourceWidth := 1024;
      iBitmapSourceHeight := 768;
      // Set the ImageEnView IEBitmap width to iBitmapSourceWidth * the number of checked images
      ImageEnView1.IEBitmap.Width := iBitmapSourceWidth *
        VerticalImageEnMView1.CheckedCount;
      // Set the ImageEnView IEBitmap height
      ImageEnView1.IEBitmap.Height := iBitmapSourceHeight;
      { Initialize iCheckedCounter value so we know where to draw the checked image }
      iCheckedCounter := -1;
      // Get the checked images and draw them to the ImageEnView IEBitmap
      for i := 0 to VerticalImageEnMView1.ImageCount - 1 do
      begin
        if VerticalImageEnMView1.Checked[i] then
        begin
          { Set the iCheckedCounter value }
          Inc(iCheckedCounter);
          // Load input file
          VerticalImageEnMView1.CopyToIEBitmap(i, iIEBitmapSource);
          // Resize iIEBitmapSource
          iIEBitmapSource.Resample(iBitmapSourceWidth, iBitmapSourceHeight,
            rfNone, True);
          // Draw Source bitmap to ImageEnView Bitmap at the position of the
          // iBitmapSourceHeight * iCheckedCounter Value
          iIEBitmapSource.DrawToTIEBitmap(ImageEnView1.IEBitmap,
            iBitmapSourceHeight * iCheckedCounter, 0);
        end;
      end;
      // Update after drawing
      ImageEnView1.Update;
      // Free the iIEBitmapSource
    finally
      iIEBitmapSource.Free;
    end;
  finally
    Screen.Cursor := crDefault;
  end;
end;

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

exchangeviews

India
39 Posts

Posted - Jul 12 2015 :  12:45:37  Show Profile  Reply
Thanks Bill. I replaced iBitmapSourceHeight with iBitmapSourceWidth in DrawToTIEBitmap(..) function and it worked fine but the problem is that I am unable to preserve the max height between all images of imageenmview. Height is being 768 for each image. BTW..I am trying to fix it. If you have any solution, please assist.
Go to Top of Page

w2m

USA
1990 Posts

Posted - Jul 12 2015 :  13:09:13  Show Profile  Reply
This maximizes the dimensions of the drawn images. I am running the app maximized... windowstate := wsMaximized:
procedure TForm1.DrawHorzontally1Click(Sender: TObject);
var
  i: Integer;
  iIndex: Integer;
  iIEBitmapSource: TIEBitmap;
  iCheckedCounter: Integer;
  iBitmapSourceWidth: Integer;
  iBitmapSourceHeight: Integer;
begin
  Screen.Cursor := crHourGlass;
  try
    ImageEnView1.Clear;
    // Create a TIEbitmap to hold the source image
    iIEBitmapSource := TIEBitmap.Create;
    try
      iBitmapSourceWidth := ImageEnView1.ClientWidth - 350;//1024;
      iBitmapSourceHeight := ImageEnView1.ClientHeight; //768;
      // Set the ImageEnView IEBitmap width to iBitmapSourceWidth * the number of checked images
      ImageEnView1.IEBitmap.Width := iBitmapSourceWidth *
        VerticalImageEnMView1.CheckedCount;
      // Set the ImageEnView IEBitmap height
      ImageEnView1.IEBitmap.Height := iBitmapSourceHeight;
      { Initialize iCheckedCounter value so we know where to draw the checked image }
      iCheckedCounter := -1;
      // Get the checked images and draw them to the ImageEnView IEBitmap
      for i := 0 to VerticalImageEnMView1.ImageCount - 1 do
      begin
        if VerticalImageEnMView1.Checked[i] then
        begin
          { Set the iCheckedCounter value }
          Inc(iCheckedCounter);
          // Load input file
          VerticalImageEnMView1.CopyToIEBitmap(i, iIEBitmapSource);
          // Resize iIEBitmapSource
          iIEBitmapSource.Resample(iBitmapSourceWidth, -1);
          // Draw Source bitmap to ImageEnView Bitmap at the position of the
          // iBitmapSourceWidth * iCheckedCounter Value
          iIEBitmapSource.DrawToTIEBitmap(ImageEnView1.IEBitmap,
            iBitmapSourceWidth * iCheckedCounter, 0);
        end;
      end;
      // Update after drawing
      ImageEnView1.Update;
      // Free the iIEBitmapSource
    finally
      iIEBitmapSource.Free;
    end;
  finally
    Screen.Cursor := crDefault;
  end;
end;

I hope this fits your needs a little better.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: