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
 Extended layer cloning

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

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


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
PeterPanino Posted - May 24 2023 : 10:10:12
When cloning a Layer: To avoid the cloned Layer becoming hidden behind the current Layer, I wrote this extended Layer cloning procedure:

with ImageEnView1 do
    var X := CurrentLayer.PosX + (Currentlayer.Width div 2); // x-position-center of the current Layer
    // x-position of the cloned Layer depending on the horizontal x-position-center of the current Layer:
    var _X: Integer;
    if X <= (IEBitmap.Width div 2) then
      _X := CurrentLayer.PosX + CurrentLayer.Width
      _X := CurrentLayer.PosX - CurrentLayer.Width;
    var OriginalName := CurrentLayer.Name;

      CurrentLayer.LayerIndex, // Insert position
      CurrentLayer,            // Layer to clone
      _X,                      // X-Position of the cloned Layer
      CurrentLayer.PosY        // Y-Position of the cloned Layer

    CurrentLayer.Name := OriginalName + '_Cloned';

Here is the result:

Can this be simplified in any way?
1   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - May 24 2023 : 23:14:04
Hi Peter

That code looks correct.

Xequte Software