ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Vectors as template
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

pierrotsc

USA
499 Posts

Posted - Oct 29 2012 :  12:49:02  Show Profile  Reply
I am trying to create a behavior and I cannot figure out on how to make it work.
I want to load an image, draw some boxes as template on top of the image.
Then i want to be able to move or rotate the image without moving the vectorial template.
Right now, if i move the image, the red boxes move with it.
Any idea if that can be done?
Thanks.
P

pierrotsc

USA
499 Posts

Posted - Oct 29 2012 :  15:56:09  Show Profile  Reply
Let me add something more. I modified the vectorial demo. I am loading a background image and drawing a box on top. I have the layer 0 unlocked. If i rotate the image, everything is good but if i move the image, the box moves with it. I do not want that. How can i prevent the vector layer not to move?
Thanks.
P
Go to Top of Page

fab

1310 Posts

Posted - Nov 06 2012 :  01:00:12  Show Profile  Reply
You may create a transparent layer 0, as static base for vectorial objects, then load the image in layer 1. Example:

  // cleanup
  ImageEnVect1.LayersClear();

  // add new layer loading from file (layer 1)
  ImageEnVect1.LayersAdd('hongkong.jpg');

  // adjust layer 0 size to match loaded image and make it transparent
  ImageEnVect1.Layers[0].Bitmap.Allocate(ImageEnVect1.Layers[1].Width, ImageEnVect1.Layers[1].Height);
  ImageEnVect1.Layers[0].Bitmap.AlphaChannel.Fill(0);

  // draw some vectorial boxes
  for i := 1 to 4 do
    with ImageEnVect1, ImageEnVect1.IEBitmap do
    begin
      ObjLayer[-1] := 1;
      AddNewObject(iekBOX, Rect(random(Width), random(Height), random(Width), random(Height)), clRed);
    end;



Now you can rotate layer 1:

  ImageEnVect1.CurrentLayer.Rotate := ImageEnVect1.CurrentLayer.Rotate + 45;
  ImageEnVect1.Update(); 
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: