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
 Learning Layers - Multiple Objects

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
HMArnold Posted - Sep 15 2024 : 15:27:48
I'm trying to draw simple shapes using the new TImageEnView environment in response to mouse movement.

In the old TImageEnVect you could add as many shapes or lines as you wanted, each with a handle that could be erased individually.

With the new TImageEnView, this code...

if TrgtC1 <> 0 then Image.LayersRemove(TrgtC1);
if TrgtC2 <> 0 then Image.LayersRemove(TrgtC2);

Rect.Create(Point(Vrtx.X-10,Vrtx.y-10),Point(Vrtx.X+10,Vrtx.Y+10));
TrgtC1 := Image.LayersAdd(iesEllipse, Rect, clRed, 3);

Rect.Create(Point(Vrtx.X-2,Vrtx.y-2),Point(Vrtx.X+2,Vrtx.Y+2));
TrgtC2 := Image.LayersAdd(iesEllipse, Rect, clBlue, 1);

Produces two concentric circles, but only erases one as the mouse moves.

Is there a single shape layer and all your shapes goes on that or is there supposed to be a different layer for each shape?

How do you add objects that have individually erasable handles?

I find lots of examples and demos with a single object, but none with two or more

Thanks

HM Arnold
3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Sep 17 2024 : 00:54:19
Hi

Not sure what you mean by a triangle being three layers. A triangle only requires one TIEShapeLayer or TIEPolylineLayer. If you need multiple shapes on a single layer, you could create a TIEPolylineLayer with a complex path (SVG type path with MoveTo, LineTo, CurveTo, etc):

http://www.imageen.com/help/TIEPolylineLayer.EnableComplexPath.html




Alternatively, you could use a "virtual layer", i.e. just draw the layer as required. Take a look at:

\Demos\LayerEditing\Layers_CustomDraw\LayersDraw.dpr

Or painted as it is sized:

\Demos\LayerEditing\SVGVectorLayers\SVGLayers.dpr


You can easily output your shapes to the Layer.Bitmap.IECanvas using the TIECanvas methods like:

http://www.imageen.com/help/TIECanvas.AdvancedDrawShape.html



Nigel
Xequte Software
www.imageen.com
HMArnold Posted - Sep 16 2024 : 07:14:16
Thanks very much.

My use of two layers is because I haven't found anything about adding multiple objects to a single layer. Is there a way to do that?

If so, I can put everything on that layer and work with it all at once, even moving the entire layer with a MouseMove hopefully.

Is that possible?

If not, a triangle is always 3 layers with 3 names?



HM Arnold
xequte Posted - Sep 15 2024 : 23:08:52
Hi

The result of LayersAdd() is an index, so you shouldn't pass that to LayersRemove() if the indexes of your layers may change.

You should identify your layers in some way, e.g. with a name:

if TrgtC1 <> '' then 
begin
  ImageEnView1.LayersRemove( ImageEnView1.LayersNameToIndex( TrgtC1 ));
  TrgtC1 := '';
end;  
if TrgtC2 <> '' then 
begin
  ImageEnView1.LayersRemove( ImageEnView1.LayersNameToIndex( TrgtC2 ));
  TrgtC2 := '';
end;  

Rect.Create(Point(Vrtx.X-10,Vrtx.y-10),Point(Vrtx.X+10,Vrtx.Y+10));
ImageEnView1.LayersAdd( iesEllipse, Rect, clRed, 3 );
TrgtC1 := 'TempLayer_' + IntToStr( Random( 10000 ));
ImageEnView1.CurrentLayer.Name := TrgtC1;

Rect.Create(Point(Vrtx.X-2,Vrtx.y-2),Point(Vrtx.X+2,Vrtx.Y+2));
ImageEnView1.LayersAdd(iesEllipse, Rect, clBlue, 1);
TrgtC2 := 'TempLayer_' + IntToStr( Random( 10000 ));
ImageEnView1.CurrentLayer.Name := TrgtC2;


Nigel
Xequte Software
www.imageen.com