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
 Displaying Vector in imageenMview

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
pierrotsc Posted - Apr 20 2016 : 09:40:10
How would I display vector objects in imageenMview?
right now, when I add a box to a layer, it does not show up in my layers?

Hope I am making sense.
Pierre
15   L A T E S T    R E P L I E S    (Newest First)
w2m Posted - Apr 21 2016 : 13:45:01
If you do not anchor a object to a layer, objects are just painted over all layers... so no matter which layer is selected you can select any object...

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
pierrotsc Posted - Apr 21 2016 : 13:41:12
Awesome. I was not aware of this command. There are so many I am sure I do not know.
Let me play to see if I do not anchor the object to the layer, where would the object show?
Not sure if I want it to show on layer zero I guess.
Best,
w2m Posted - Apr 21 2016 : 13:17:58
that is easy enough... just draw one object at a time for all objects in a layer:
procedure DrawOneObjectToBitmap(hobj: integer; target: TIEBitmap; Antialias: boolean = true; AdaptBitmapPixelFormat: boolean = true);

Something like this (Untested):
for i:= 0 to ImageEnVect1.LayerCount-1 do
begin
  for j := ImageEnVect1.ObjectsCount - 1 downto 0 do
  begin
    ihobj := ImageEnVect1.GetObjFromIndex(j);
    // if hobj is on current layer then copy the object
    iobjLayer := ImageEnVect1.ObjLayer[ihobj];
    if iobjLayer = i then
      ImageEnVect1.DrawOneObjectToBitmap(ihobj, ImageEnMView1.IEBitmap, True);
  end;
end;

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
pierrotsc Posted - Apr 21 2016 : 13:00:00
the only thing that prevents the code to work fully is that I need to detect if a layer has objects anchor to it and then only copy the objects from this layer and not all the objects. the drawobjectstobitmap copies every objects regardless on which layers they are anchored to.
pierrotsc Posted - Apr 21 2016 : 12:54:27
Thanks Bill. I can really only look at the code. Even modifying it to work under 5.2.2 and XE gives me errors.
Anyway, I may have found a way by looking at your code. It's still not 100 % working but it is getting there. Look below

procedure TMainform.Refreshlayerviewer;
var
  i, idx: Integer;

begin
  // ShowMessage('refresh layer viewer:');
  LayerView.CenterSelected;
  LayerView.Clear;
  for i := 0 to ImageEnVect.LayersCount - 1 do
  begin
    ImageEnVectPreview.LayersClear;
    ImageEnVectPreview.RemoveAllObjects;
    ImageEnVectPreview.Assign(ImageEnVect.layers[i].Bitmap);
    if i = ImageEnVect.LayersCurrent then
      ImageEnVect.DrawObjectsToBitmap(ImageEnVectPreview.IEBitmap, True, True);
    ImageEnVectPreview.Update;
    ImageEnVectPreview.LayersMergeAll;
    idx := LayerView.AppendImage;
    LayerView.SetIEBitmap(idx, ImageEnVectPreview.IEBitmap);
    if i = 0 then
      LayerView.ImageTopText[0].Caption := 'Background'
    else
      LayerView.ImageTopText[i].Caption :=
        string(ImageEnVect.layers[ImageEnVect.LayersCurrent].Name);
  end;
  LayerView.SelectedImage := ImageEnVect.LayersCurrent;
  LayerView.Update;
end;
pierrotsc Posted - Apr 21 2016 : 07:23:35
Thanks Bill. Let me look at the code and see if I can make it work with XE and 5.2.2
Appreciate the help really.
Pierre
w2m Posted - Apr 20 2016 : 18:06:04
ImageEnMView/ImageEnVect Demo2:
attach/w2m/201642018357_ImageEnMViewImageEnVect2.zip
64.23 KB
Revised demo to preview layers and objects. With large images this maybe sluggish so I would recommend not previewing multiple layers. You may have to adjust this to meet your needs... but it does function.


Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
pierrotsc Posted - Apr 20 2016 : 16:52:41
if I load an image and layer 0 is not locked, I can move the image around. I will have to look at my code as I know that I can move a bitmap on layer zero with the boxes staying at the same place independently of the image all in the same layer. I use the boxes to create a template to fit the loaded image.
w2m Posted - Apr 20 2016 : 16:00:16
The background layer can not be moved. If the objects are anchored to the layer, when you move the layer the objects stay in the same location in the layer, but if the layer is moved the objects also move along with the layer. If the objects are anchored to a layer they cannot be moved off the layer.

If you need to be able to move the "background image" it will have to be added to a layer and resized to fit layer 0. Layer 0 or the background could be made transparent, so then you could move the background image.

With respect to the layer images and the thumbnail, it could get messy drawing all the layers as a thumbnail but it is possible.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
pierrotsc Posted - Apr 20 2016 : 15:53:57
The layers by default are transparent but the user can load a bitmap. Either way.
Yes, the boxes needs to be moveable and resizable. But it is best for them to be anchored to the layer. Will have to check. I need to be able to move the background image while the boxes do not move. They both should be on the same layer.
The thumbnail should show the current background layer. I have the ability to load images into each layers, so they should show in the thumbnails.
All that could make it complicated I guess.
Thanks.
Pierre
w2m Posted - Apr 20 2016 : 15:41:01
1. Do your layers contain a bitmap or are they transparent?
2. Do you want the objects created so they can be moved off a layer (can be moved anywhere) or do you want the objects to be contained within or anchored to the layer?
3. Which background image do you want to appear in the thumbnail... the background (layer 0) or the selected layer (1..xx)?

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
pierrotsc Posted - Apr 20 2016 : 15:00:06
Thank you. I will work on that at the same time. Appreciate it.
w2m Posted - Apr 20 2016 : 14:49:50
I did not take the time to make a demo with layers, but here is how you can draw the vectorial objects on TImageEnMView.

ImageEnMView/ImageEnVect Demo:
attach/w2m/2016420144829_ImageEnMViewImageEnVect.zip
63.43 KB

Tomorrow I'll try adding layers.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
pierrotsc Posted - Apr 20 2016 : 10:45:47
Nope, the demo was not with vectors. Any help coding. This is what I am using but it does not show vectors.

  LayerView.CenterSelected;
  // update ImageEnMView1 with the contents of ImageEnView1
  LayerView.Clear;
  for i := 0 to ImageEnVect.LayersCount - 1 do
  begin
    idx := LayerView.AppendImage;
    LayerView.SetIEBitmap(idx, ImageEnVect.layers[i].Bitmap);
    if i = 0 then
      LayerView.ImageTopText[0].Caption := 'Background'
    else
      LayerView.ImageTopText[i].Caption :=
        string(ImageEnVect.layers[ImageEnVect.LayersCurrent].Name);
  end;
  LayerView.SelectedImage := ImageEnVect.LayersCurrent;
  LayerView.Update;
pierrotsc Posted - Apr 20 2016 : 10:29:22
Hold on. I may have found a demo that may help me. Will update the thread if not.