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
 Layer Editor - Fixed Page Size
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

corundum

USA
8 Posts

Posted - Aug 27 2021 :  13:33:16  Show Profile  Reply
I'm not sure that this is specific to layers, but I'd like to be able to set the size of a drawing area (e.g, background layer???) to a standard paper size (say, US 8.5 x 11 inches) and keep the page fixed at that size (no expansion if a layer is moved outside the page size, for example). How would this be accomplished?

xequte

6332 Posts

Posted - Aug 27 2021 :  20:10:16  Show Profile  Reply
Hi

You can set the background image (layer[0]) to the desired size and then:

1. Enable loPreventOutOfBounds in LayerOptions:

https://www.imageen.com/help/TImageEnView.LayerOptions.html


2. Crop any layers moved outside the background layer:

https://www.imageen.com/help/TImageEnView.LayersCropped.html


3. Adjust layer bounds as the user moves the layer:

https://www.imageen.com/help/TImageEnView.OnLayerMoveSize.html



Nigel
Xequte Software
www.imageen.com
Go to Top of Page

corundum

USA
8 Posts

Posted - Aug 30 2021 :  10:15:02  Show Profile  Reply
Nigel:

When I set LayersCropped to True, I am able add draw shapes, but they don't draw. This can be replicated by adding the following line as the first line in FormCreate in the Layers_AllTypes demo:

ImageEnView1.LayersCropped := True;


A screenshot is attached.

Greg


Go to Top of Page

xequte

6332 Posts

Posted - Aug 30 2021 :  18:35:45  Show Profile  Reply
Hi

Yes, because they are outside your background layer (which appears to empty). If you want them to paint you need to create a background layer, e.g.

  ImageEnView1.IEBitmap.Allocate(500, 500, clWhite);
  ImageEnView1.Update();


If you don't want it visible, set Alpha to 0.

  ImageEnView1.IEBitmap.Allocate(500, 500, clWhite, 0);
  ImageEnView1.Update();


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

corundum

USA
8 Posts

Posted - Aug 31 2021 :  13:31:43  Show Profile  Reply
Nigel:

I'm still getting the same result. The FormCreate code I'm using is below. The only code I added to the demo are the first three lines of this method.

Greg

procedure Tfmain.FormCreate(Sender: TObject);
begin  
  ImageEnView1.IEBitmap.Allocate(500, 500, clWhite);
  ImageEnView1.Update();
  ImageEnView1.LayersCropped := True;

  fUpdating := True;
  IEInitializeComboBox(cmbShape);

  // Enable dragging of thumbnails to rearrange layers and remove layers
  IELayerMView1.LayerOptions := IELayerMView1.LayerOptions +
    [lvDragOrdering, lvDragDelete];

  // Show layer descriptions on hover
  IELayerMView1.ShowThumbnailHint := True;

  IELayerMView1.ReadOnly := False;

  ImageEnView1.Proc.UndoLimit := 30;
  ImageEnView1.LayerOptions := ImageEnView1.LayerOptions +
    [loAutoUndoChangesByuser, loAutoUndoChangesByCode];
end;
Go to Top of Page

xequte

6332 Posts

Posted - Sep 01 2021 :  17:29:52  Show Profile  Reply
Hi Greg

The demo calls ImageEnView1.Blank() in FormShow. So you need to set the bitmap size after that.

You can ensure you have a valid background by checking the size where it says "Background" in the LayerMView on the left.

If no size is shown then it is blank.




Here's an example where the background is transparent:



Nigel
Xequte Software
www.imageen.com
Go to Top of Page

aleatprog

80 Posts

Posted - Sep 02 2021 :  03:43:46  Show Profile  Reply
Hi Greg,

once you see the size information in layer[0] (in Nigel's example: 500 x 500) your problem is solved as ImageEnView1.LayersCropped := True uses these values.

You also may use IELayerMView1.Update in order to see the updated situation in the attached ImageEnLayerMView.

ImageEnView1.IEBitmap.Allocate(500, 500, clWhite);
ImageEnView1.Update;
ImageEnLayerMView1.Update;

Al
Go to Top of Page

corundum

USA
8 Posts

Posted - Sep 09 2021 :  20:06:23  Show Profile  Reply
Just getting back to this now. It's now working as expected. Thank you!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: