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
 Arrange Layers based on First layers orientation

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
yogiyang Posted - Sep 04 2017 : 06:40:15
Hello,

I have a need to arrange three layers which are loaded using files selected by user.

Base on the photo loaded in first layer (layer 1 not layer 0) I need to arrange the other layers.

Currently my layers are getting arranged uniformly like this (in 1024x768 size):


If above image is observed then you will notice that the first loaded photo is having portrait orientation so the arrangement should be like this:


What would be the best way to achieve this. Here the number of photos a user can load would be any thing between 1 to 8.

TIA


Yogi Yang
2   L A T E S T    R E P L I E S    (Newest First)
w2m Posted - Sep 05 2017 : 10:36:25
All you have to do is depending on the number of layers is to position and set the dimensions of each layer accordingly.
The following code creates a 3 image layout as you specified. You will have to modify this to create other layouts.
Only you can do this because only you know what the layouts should look like.
This code does not attempt to determine the orientation, it merely shows how to show the layers as you indicated in your post.
You can determine the orientation by comparing the IEBitmap.Width and IEBitmap.Height and adjust the code accordingly.
procedure TForm1.Preview1Click(Sender: TObject);
var
  i: Integer;
  iCount: Integer;
  iLayer: Integer;
  iMidPointX: Integer;
  iMidPointY: Integer;
  iWidth: Integer;
  iHeight: Integer;
  iMarginX: Integer;
  iMarginY: Integer;
  iZoom: Double;
begin
  iCount := ImageEnMView1.ImageCount;
  if iCount > 0 then
  begin
    ImageEnView1.Proc.ImageResize(1024, 768);
    ImageEnView1.Proc.Fill(clWhite);
    iWidth := ImageEnView1.Layers[0].Width;
    iHeight := ImageEnView1.Layers[0].Height;
    iMarginX := 10;
    iMarginY := 10;
    iMidPointX := iWidth div 2;
    iMidPointY := iHeight div 2;
    iCount := ImageEnMView1.ImageCount;
    iZoom := ImageEnView1.Zoom;
    for i := 1 to iCount do
    begin
      iLayer := ImageEnView1.LayersAdd;
      ImageEnMView1.CopyToIEBitmap(iLayer - 1, ImageEnView1.IEBitmap);
      ImageEnView1.Update;
      ImageEnView1.Layers[iLayer].Name := 'Image Layer ' + IntToStr(i);
      if i = 1 then
      begin
        ImageEnView1.Layers[iLayer].PosX := iMarginX;
        ImageEnView1.Layers[iLayer].PosY := iMarginY;
        ImageEnView1.Layers[iLayer].Width := iMidPointX - iMarginX * 2;
        ImageEnView1.Layers[iLayer].Height := iMidPointY - iMarginY;
      end;
      if i = 2 then
      begin
        ImageEnView1.Layers[iLayer].Width := iMidPointX - iMarginX * 2;
        ImageEnView1.Layers[iLayer].Height := iMidPointY - iMarginY * 2;
        ImageEnView1.Layers[iLayer].PosX := iMarginX;
        ImageEnView1.Layers[iLayer].PosY := iMidPointY + iMarginY;
      end;
      if i = 3 then
      begin
        ImageEnView1.Layers[iLayer].PosX := iMidPointX;
        ImageEnView1.Layers[iLayer].PosY := iMarginY;
        ImageEnView1.Layers[iLayer].Width := iMidPointX - iMarginX;
        ImageEnView1.Layers[iLayer].Height := iHeight - iMarginY * 2;
      end;
      ImageEnView1.Update;
    end;
  end;
end;



Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
xequte Posted - Sep 04 2017 : 22:40:45
Hi Yogi

I'm not sure of any easy solution to this, other than a set of pre-defined layouts, but with up to eight images of either portrait or landscape, there are probably too many variations.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com