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
 ImageEnView CurrentLayer Add Shape In Code, Then Pan Shape To Center

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
andyhill Posted - Sep 03 2022 : 02:09:05
I load a very large image on layer 0.

Then I add via code a rectangle mask which may be out of view subject to zoom level and X/Y positioning.

ImageEnView1.LayersAdd(ielkShape);
TIEShapeLayer(ImageEnView1.CurrentLayer).Shape:= iesRoundRect;
ImageEnView1.CurrentLayer.PosX:= x1;
ImageEnView1.CurrentLayer.PosY:= y1;
ImageEnView1.CurrentLayer.Width:= x2;
ImageEnView1.CurrentLayer.Height:= y2;
ImageEnView1.CurrentLayer.FillColor:= clNone;
ImageEnView1.CurrentLayer.AlphaEdgeFeathering:= 50;
ImageEnView1.CurrentLayer.IsMask:= True;
ImageEnView1.Update();

How can I in code now pan the background image (ImageEnView1 display) centering the newly added rectangle mask within the display area, or at worst scroll it so that it is top left ?

Andy
7   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Sep 05 2022 : 16:25:07
Hmm, I can't seem to reproduce that.


Nigel
Xequte Software
www.imageen.com
andyhill Posted - Sep 05 2022 : 15:28:31
ImageEnView1.SetViewXY(ImageEnView1.CurrentLayer.PosX, ImageEnView1.CurrentLayer.PosY); FAILED ON VERY LARGE BASE IMAGE (10,000px x 10,000px dpi 300)

ImageEnView1.VisibleBitmapRect:= ImageEnView1.Layers[2].LayerRect; WORKED

Andy
xequte Posted - Sep 04 2022 : 18:31:42
Hi Andy

These methods work for me:

// Setup test
ImageEnView1.LayersClear(True);
ImageEnView1.IO.LoadFromFile('D:\Testing\Big_Big_Pix\img40946_25MP.jpg');
ImageEnView1.LayersAdd( iesEllipse, 2030, 2200, 350, 450 );

// Scroll the view to show the current layer
ImageEnView1.SetViewXY( ImageEnView1.CurrentLayer.PosX, ImageEnView1.CurrentLayer.PosY );

// Fully display layer #1 in view
ImageEnView1.VisibleBitmapRect := ImageEnView1.Layers[2].LayerRect;

// Fully display layer #1 in view
lyr := ImageEnView1.Layers[2];
ImageEnView1.VisibleBitmapRect := Rect( lyr.PosX, lyr.PosY, lyr.PosX + lyr.Width, lyr.PosY + lyr.Height );



Nigel
Xequte Software
www.imageen.com
andyhill Posted - Sep 04 2022 : 18:09:18
Even tried

ImageEnView1.SetViewXY(ImageEnView1.XScr2Bmp(x1, False), ImageEnView1.YScr2Bmp(y1, False));

ImageEnView1.SetViewXY(ImageEnView1.XScr2Bmp(x1, True), ImageEnView1.YScr2Bmp(y1, True));

Still does not pan into view correctly (mostly fails to show Mask in view) ???


Andy
andyhill Posted - Sep 04 2022 : 17:00:26
ImageEnView1.SetViewXY(x1, y2);

Brings into view barely, why y2 and not y1 ???

Andy
andyhill Posted - Sep 04 2022 : 00:42:24
Tried your suggestions no go ?

//ImageEnView1.VisibleBitmapRect:= Rect(x1, y1, x2, y2);
//ImageEnView1.VisibleBitmapRect:= ImageEnView1.Layers[1].ClientAreaBox;
//ImageEnView1.VisibleBitmapRect:= ImageEnView1.CurrentLayer.ClientAreaBox;
ImageEnView1.ViewX:= x1;
ImageEnView1.Update();
//ImageEnView1.ViewY:= y1;
//ImageEnView1.Update();


|-------------------Layer Zero---------------|
|----------------------|                     |
|---------View---------|                     |
|----------------------|                     |
|                                            |
|                             |--------------|
|                             |-----Mask-----|
|                             |--------------|
|                                            |
|                                            |
|--------------------------------------------|


Andy
xequte Posted - Sep 04 2022 : 00:20:58
Hi Andy

You can set ViewX/Y to scroll to a position on the image:

http://www.imageen.com/help/TImageEnView.ViewX.html


Or you can use VisibleBitmapRect to display a rect:

http://www.imageen.com/help/TImageEnView.VisibleBitmapRect.html

Nigel
Xequte Software
www.imageen.com