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
 Printing merged layers...

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
bmesser Posted - Jan 21 2013 : 06:25:00
Hi

I have an TImageEnView component with a base map layer, then overlaid with a rainfall radar image, and finally on top of these a coastal outline.

I have managed to save an image that comprised of two other image using the LayersMergeTo method and I take it that there is no reason why I shouldn't add a third image by the same method?

What I would like to do is to send a merged image to the printer using the same technique possibly with the DoPrintPreviewDialog method to preview what I'm printing. Is this possible within the component or would I have to use a separate external bitmap to do this?

Bruce.
6   L A T E S T    R E P L I E S    (Newest First)
bmesser Posted - Dec 19 2013 : 15:12:55
Thanks Bill (and User) I'll get back to you after Christmas on the results!

Have a happy Christmas in the mean time.

Bruce.
w2m Posted - Dec 18 2013 : 13:07:29
With respect to TImageEnView layers try this:
procedure TForm1.PreviewLayers1Click(Sender: TObject);
{ Print Preview Layers. }
var
  iMS: TMemoryStream;
begin
  { Draw the layers to Preview1... }
  ImageEnView1.LayersDrawTo(Preview1.IEBitmap);
  Preview1.Update;
  { Do print preview }
  if Preview1.IO.DoPrintPreviewDialog() then
    begin
      Preview1.Clear;
      { Restore the preview layers }
      iMS := TMemoryStream.Create;
      try
        ImageEnView.LayersSaveToStream(iMS);
        iMS.Position := 0;
        Preview1.LayersLoadFromStream(iMS);
        Preview1.Update;
      finally
        iMS.Free;
      end;
    end;
  end;
end;

This draws the layers to a second TImageEnView (Preview1), shows the print preview dialog, then restores Preview to its original condition.

With respect to TImageEnVect try this:
procedure TForm1.PrintPreview1Click(Sender: TObject);
{ Print Preview. }
var
  iMS: TMemoryStream;
begin
  { Draw the layers to ImageEnVectPreview1... also draws the objects }
  ImageEnVect1.LayersDrawTo(ImageEnVectPreview1.IEBitmap);
  ImageEnVectPreview1.Update;
  { Do print preview }
  if ImageEnVectPreview1.IO.DoPrintPreviewDialog() then
  begin
     ImageEnVectPreview1.Clear;
    { Update the preview layers and objects }
      iMS := TMemoryStream.Create;
      try
        ImageEnVect1.LayersSaveToStream(iMS);
        iMS.Position := 0;
        ImageEnVectPreview1.LayersLoadFromStream(iMS);
        ImageEnVectPreview1.Update;
      finally
        iMS.Free;
      end;
  end;
end;

This draws the layers and objects to ImageEnVectPreview1, displays the print preview dialog, then restores the ImageEnVectPreview1 to its original condition.

Both of these work for me with the latest version. By drawing the layers and objects to another TImageEnVect the original remains unchanged.

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
User Posted - Dec 18 2013 : 13:02:03

  ImageEnView1.Proc.SaveUndo(ieuObjectsAndLayers);
  try
    ImageEnView1.LayersMergeAll;
    ImageEnView1.IO.DoPrintPreviewDialog();
  finally
    ImageEnView1.Proc.Undo;
    ImageEnView1.Proc.ClearUndo; // !!!
  end;
bmesser Posted - Dec 18 2013 : 10:43:34
Hi

I did find this method did work - and in part it does. It copies the layers to a local TImageEnView component and allows you to merge the layers and print it, but when you go back to the "source" component its now empty.

I checked the help and it says the same thing:

Transfers the current image, all layers and input/output parameters to the destination TImageEnView component.

Note:
- This method doesn't copy the images, but transfers pointers to the image buffer
- After the operation the source component will be empty, and all previous images will be removed from "Destination"

Perhaps things have changed in the later versions.

Is there a quick and easy way to merge layers into a single image that you can either save, print or copy?

Bruce.

PS I have a supplementary questions in a similar vein about how to print from a TImageEnVect component - how do you combine all layers (and any related objects) into a single image that you can either save, print of copy?
bmesser Posted - Jan 22 2013 : 09:25:55
Bill

I thought it might be possible without getting too complicated!

Thanks once again.

Bruce.
w2m Posted - Jan 21 2013 : 07:39:58
You could use a TIEBitmap, but this is faster and better:

procedure TForm1.Print1Click(Sender: TObject);
// Print preview all layers leaving the original layers unchanged
var
  iImageEnView: TImageEnView;
begin
  iImageEnView := TImageEnView.Create(nil);
  try
    // Transfer the current image, all layers and input/output parameters to destination TImageEnView component
    ImageEnView1.MoveContentTo(iImageEnView);
    iImageEnView.Update;
    // Call LayersMergeAll to merge all layers in one step
    iImageEnView.LayersMergeAll;
    // Show the print preview dialog
    iImageEnView.IO.DoPrintPreviewDialog();
  finally
    iImageEnView.Free;
  end;
end;

William Miller
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html