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
 Guides and Snap to Guides

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 - Mar 07 2016 : 01:50:46
Hello,

In the software that we have developed we need to implement Dynamic Guides which will show when the user is either moving or resizing a photo/layer.

We do not only want to show the guide we also want to snap the photo/layer in question as per the operation being performed.

In short the functionality that we are seeking is similar to what is provided by DelphiC++Builder IDE when we are moving or resizing a control. But in case of DelphiC++Builder IDE the control in question does not snap to a guide but in our case we need to snap it to the nearest dynamic guide.

If anyone has any ideas please do share.

TIA


Yogi Yang
3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - May 25 2020 : 22:23:34
Hi

Unfortunately, I'm not sure that there's an easy way to do it with TImageEnVect...

Nigel
Xequte Software
www.imageen.com
kturkay Posted - May 24 2020 : 01:24:46
hi!,
I am looking for imageenvect objects (selected one) snapping ability. am I missed something in help file ?

not important no need any efforts, just I thought it would be good to know if something exists also for objects something like layers. (btw... code below, not works good. moving objects flickers).thats my first attemption. result=object flickers on move or resize. do you know a better solution or maybe a property I missed?


procedure Tfmmain.ImageenVect1ObjectMoveResize(Sender: TObject; hobj, Grip: Integer;
  var OffsetX, OffsetY: Integer);
var
  iv:TImageenVect;
  isResize: boolean;
  PosX, PosY, width_, height_: Integer;
begin
  iv:=ImageenVect1;
  isResize := (Grip <> 3);

  PosX := Iv.ObjLeft[hobj];
  PosY := Iv.ObjTop[hobj];
  width_ := Iv.ObjWidth[hobj];
  height_ := Iv.ObjHeight[hobj];

  if not isResize then
  begin
    Iv.ObjLeft[hobj] := SnapToGrid(PosX);
    Iv.ObjTop[hobj] := SnapToGrid(PosY);
  end
  else   //otherwise it should resize ? probably
  begin
    Iv.ObjWidth[hobj] := SnapToGrid(PosX + width_) - PosX;
    Iv.ObjHeight[hobj] := SnapToGrid(PosY + height_) - PosY;
  end;

end;


-we love Imageen-
xequte Posted - Mar 07 2016 : 19:54:15
Hi Yogi

You can just use the LayerNotify event:

function SnapToGrid(value: Integer) : integer;
const
  GRID_SIZE = 8;
begin
  // Simplistic snap to grid algorithm
  Result := Value - ( value mod GRID_SIZE );
end;

procedure Tfmain.ImageEnView1LayerNotify(Sender: TObject; layer: Integer; event: TIELayerEvent);
begin
  with ImageEnView1.Layers[ Layer ] do
  begin
    if event = ielMoved then
    begin
      PosX   := SnapToGrid( PosX );
      PosY   := SnapToGrid( PosY );
    end
    else
    if event = ielResized then
    begin
      Width  := SnapToGrid( PosX + Width ) - PosX;
      Height := SnapToGrid( PosY + Height ) - PosY;
    end;
  end;
end;


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