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
 Layers images (Delphi RIO)

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
DanielT. Posted - Sep 26 2019 : 05:04:58
Please.

with the same size and position.

Loads a list of backgrounds, for example, in the left column of ImageEnMView1, loads a list of layers in the right column of ImageEnMView2.

I select the first background image from ImageEnMView1 and select the layer image from ImageEnMView2.

I configure the position of the background layer.

Next, I need to start creating all background and layer combinations according to the template.

Can it be done?

Thank you
5   L A T E S T    R E P L I E S    (Newest First)
DanielT. Posted - Sep 27 2019 : 04:29:36
Thank you
xequte Posted - Sep 26 2019 : 19:15:29
Hi

Have you tried the demo:

Demos\LayerEditing\Layers_DragDrop\Layers_DragDrop.dpr

Use the code in the ImageEnView1DragDrop method, to show how to add the selected item in a TImageEnMView as a layer to a TImageEnView, e.g.

For an image layer:

    idx := ImageEnMView1.SelectedImage;
    if idx >= 0 then
    begin
      bmp := ImageEnMView1.GetTIEBitmap( idx );
      ImageEnView1.LayersAdd( bmp );
      ImageEnView1.CurrentLayer.PosX := X;
      ImageEnView1.CurrentLayer.PosY := Y;
      ImageEnMView1.ReleaseBitmap( idx, False );
    end;


Nigel
Xequte Software
www.imageen.com
DanielT. Posted - Sep 26 2019 : 10:15:49
Is it possible to build a demo for my question?

Left list is backgrounds, right list is layers.

I think this will help more people understand.
Thank you very much.


unit unMain;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, JvToolEdit, Vcl.StdCtrls, Vcl.Mask,
  JvExMask, Vcl.ExtCtrls, hyieutils, iexBitmaps, hyiedefs, iesettings,
  iexLayers, iexRulers, ieview, iemview, imageenview;

type
  TfrmMain = class(TForm)
    Panel1: TPanel;
    Panel3: TPanel;
    Panel4: TPanel;
    Panel5: TPanel;
    Panel6: TPanel;
    ImageEnMView2: TImageEnMView;
    ImageEnMView1: TImageEnMView;
    ImageEnView1: TImageEnView;
    btnAddBackground: TButton;
    btnAddLayer: TButton;
    Button3: TButton;
    Button4: TButton;
    OpenDialogBackground: TOpenDialog;
    OpenDialogLayer: TOpenDialog;
    btnCreateCombinations: TButton;
    procedure ImageEnMView1ImageSelect(Sender: TObject; idx: Integer);
    procedure ImageEnMView2ImageSelect(Sender: TObject; idx: Integer);
    procedure btnAddBackgroundClick(Sender: TObject);
    procedure btnAddLayerClick(Sender: TObject);
    procedure btnCreateCombinationsClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmMain: TfrmMain;
  cntBackground, cntLayers, cntCombinations: integer;
  imgBackgroundLeft, imgBackgroundTop, imgBackgroundWidth, imgBackgroundHeight: integer;
  imgLayerLeft, imgLayerTop, imgLayerWidth, imgLayerHeight: integer;

implementation

{$R *.dfm}

procedure TfrmMain.btnAddBackgroundClick(Sender: TObject);
begin
  ImageEnView1.IO.Params.PSD_LoadLayers := true;

  if OpenDialogBackground.Execute then
  begin

    ImageEnMView1.FillFromList(OpenDialogBackground.Files);

    ImageEnView1.CurrentLayer.Width := 1000;
    ImageEnView1.CurrentLayer.Height := 1000;

  end;
end;


procedure TfrmMain.btnAddLayerClick(Sender: TObject);
begin
  ImageEnView1.IO.Params.PSD_LoadLayers := true;

  if OpenDialogLayer.Execute then
  begin
    ImageEnMView2.FillFromList(OpenDialogLayer.Files);

    ImageEnView1.CurrentLayer.Width := 1000;
    ImageEnView1.CurrentLayer.Height := 1000;

  end;
end;



procedure TfrmMain.btnCreateCombinationsClick(Sender: TObject);
var
  background, layer: integer;
  ExtName: string;
begin
  cntBackground := ImageEnMView1.ImageCount;

  cntLayers := ImageEnMView2.ImageCount;

  cntCombinations :=  cntBackground * cntLayers;

  ExtName := '.jpg';

  (*
  imgBackgroundLeft, imgBackgroundTop, imgBackgroundWidth, imgBackgroundHeight: integer;
  imgLayerLeft, imgLayerTop, imgLayerWidth, imgLayerHeight: integer;
  *)

  ImageEnMView1.SelectImage(0);

  with ImageEnView1 do
  begin
    ImageEnMView2.SelectImage(0);

    with CurrentLayer do
    begin
      imgLayerLeft := PosX;
      imgLayerTop := PosY;
      imgLayerWidth := Width;
      imgLayerHeight := Height;
    end;


    ImageEnMView1.SelectImage(0);
    with CurrentLayer do
    begin
      imgBackgroundLeft := PosX;
      imgBackgroundTop := PosY;
      imgBackgroundWidth := Width;
      imgBackgroundWidth := Height;
    end;
  end;

  ShowMessage('Total will be created: '+ IntToStr(cntCombinations)+ ' images');

  for layer := 0 to cntBackground -1 do
  begin
    // here recursive change layer
    ImageEnMView2.SelectImage(layer);

    // change size and position layer
    with ImageEnView1 do
    begin
      with CurrentLayer do
      begin
        PosX := imgLayerLeft;
        PosY := imgLayerTop;
        Width := imgLayerWidth;
        Height := imgLayerHeight;
      end;
    end;

     for background := 0 to cntLayers -1 do
     begin
       // here recursive change background
       ImageEnMView1.SelectImage(background);


       // change size and position background
       with ImageEnView1 do
       begin
         with CurrentLayer do
         begin
           PosX := imgBackgroundLeft;
           PosY := imgBackgroundTop;
           Width := imgBackgroundWidth;
           Height := imgBackgroundHeight;
         end;
       end;

       // here recursive saved combinations
       //ImageEnMView2 selected image name + ' ' + ImageEnMView1 selected image name + ExtName
       ImageEnView1.LayersSaveMergedTo('');
     end;

  end;
end;

procedure TfrmMain.ImageEnMView1ImageSelect(Sender: TObject; idx: Integer);
begin
  with ImageEnView1 do
  begin
    LayersCurrent := idx;
  end;
end;


procedure TfrmMain.ImageEnMView2ImageSelect(Sender: TObject; idx: Integer);
begin
  with ImageEnView1 do
  begin
    LayersCurrent := idx;
  end;
end;


end.
DanielT. Posted - Sep 26 2019 : 08:40:58
Good day.
I'm getting started with ImageEn.
So I'm learning to understand how it works.
Retrieving the image list is not a problem.
I don't know how to change the background image and layer image.
I can see that you can also specify the location and dimensions.


When I select a picture from the left and a picture from the right, nothing is displayed:


procedure TfrmMain.JvFilenameEdit1AfterDialog(Sender: TObject; var AName: string;
  var AAction: Boolean);
begin
  ImageEnMView1.FillFromList(JvFilenameEdit1.DialogFiles);
end;

procedure TfrmMain.JvFilenameEdit2AfterDialog(Sender: TObject; var AName: string;
  var AAction: Boolean);
begin
  ImageEnMView2.FillFromList(JvFilenameEdit2.DialogFiles);
end;

procedure TfrmMain.ImageEnMView1ImageSelect(Sender: TObject; idx: Integer);
begin
  with ImageEnView1 do
  begin
    LayersCurrent := idx;
  end;
end;

procedure TfrmMain.ImageEnMView2ImageSelect(Sender: TObject; idx: Integer);
begin
  with ImageEnView1 do
  begin
    LayersCurrent := idx;
  end;
end;

xequte Posted - Sep 26 2019 : 06:48:47
Hi

Yes, this can all be done. Which aspect is giving your difficulty?

Nigel
Xequte Software
www.imageen.com