I have been exploring a feature of TImageEnMView to display objects in TImageEnVect that I have not tried before and there is no demo code to handle this that I can find.
Currently my demo code can display the objects painted on the selected TImageEnMView, but when the objects are saved to a TIFF file and then opened, the painted objects are also shown in the TImageEnVect as painted (merged) and the objects are also placed on top of the painted objects.
When I move or resize an object the moved/resized object is painted in the TImageEnMView thumbnail, but the old painted object remains. The TImageEnMView thumbnail should show the background image along with the repositioned/resized TImageEnVect objects.
Can you show some code that:
1. Shows the objects in TImageEnMView, so that when the TImageEnVect object is moved the TImageEnMView displays the objects correctly in the thumbnail.
2. When the file is saved to a TIFF file the background image and only the objects are saved... the tiff frames should not be painted with the objects.
3. When the file is opened from a TIFF file, the objects are displayed in the TImageEnMView frame.
4. When a image is selected in TImageEnMView, the objects for the selected frame are shown in the TImageEnVect but appear a objects and not painted objects.
Is this possible... show painted objects in TImageEnMView, but only save the background image and the objects and show the background image and painted objects in ImageEnMView when the TIFF file is opened. Then when the TImageEnMView selection changes, load the objects as objects for the selected TIFF frame?
Here is some code:
procedure TForm1.SaveAs1Click(Sender: TObject);
{ Save all the tif file frames and all the annotations to disk. }
begin
if SavePictureDialog1.Execute then
begin
ImageEnVect1.IO.Params.ImagingAnnot.CopyFromTImageEnVect(ImageEnVect1);
ImageEnMView1.MIO.SaveToFileTIFF(SavePictureDialog1.FileName, False);
ImageEnVect1.Bitmap.Modified := False;
UpdateGUI;
Caption := SavePictureDialog1.FileName +
'- Load Multiframe TIF File On Demand With Annotations';
StatusBar1.Panels[0].Text := ExtractFileDir(SavePictureDialog1.FileName);
StatusBar1.Panels[1].Text := ExtractFileName(SavePictureDialog1.FileName);
end;
end;
procedure TForm1.Open1Click(Sender: TObject);
{ Open multiframe tif file with annotations. }
begin
OpenPictureDialog1.Options := [ofHideReadOnly, ofEnableSizing];
OpenPictureDialog1.FilterIndex := 5;
OpenPictureDialog1.FileName := '';
OpenPictureDialog1.DefaultExt := '.tif';
if OpenPictureDialog1.Execute then
begin
ImageEnMView1.MIO.LoadFromFile(OpenPictureDialog1.FileName, False);
ImageEnMView1.SelectedImage := 0;
ImageEnVect1.IO.LoadFromFile(OpenPictureDialog1.FileName);
ImageEnMView1.MIO.Params[ImageEnMView1.SelectedImage].ImageEnAnnot.CopyToTImageEnVect();
ImageEnVect1.LoadObjectsFromTIFF(OpenPictureDialog1.FileName, 0);
ImageEnVect1.Bitmap.Modified := False;
ImageEnVect1.Fit();
UpdateGUI;
StatusBar1.Panels[0].Text := ExtractFileDir(OpenPictureDialog1.FileName);
StatusBar1.Panels[1].Text := ExtractFileName(OpenPictureDialog1.FileName);
StatusBar1.Panels[2].Text := 'Frames: ' +
IntToStr(ImageEnMView1.ImageCount);
StatusBar1.Panels[3].Text := 'Frame: ' +
IntToStr(ImageEnMView1.SelectedImage);
if ImageEnMView1.MIO.Params[ImageEnMView1.SelectedImage]
.ImagingAnnot.ObjectsCount <> 0 then
StatusBar1.Panels[5].Text := 'Objects: ' +
IntToStr(ImageEnMView1.MIO.Params[ImageEnMView1.SelectedImage]
.ImagingAnnot.ObjectsCount)
else
StatusBar1.Panels[5].Text := 'Objects: ' +
IntToStr(ImageEnVect1.ObjectsCount);
StatusBar1.Panels[6].Text := 'Object:';
end;
end;
procedure TForm1.ImageEnVect1VectorialChanged(Sender: TObject);
begin
ImageEnVect1.SaveObjectsToTIFF(ImageEnMView1.MIO.Params[ImageEnMView1.SelectedImage].FileName, ImageEnMView1.SelectedImage);
end;
As an alternative should a TIEMultiBitmap be created to hold the individual frames and then use TImageEnView to display the frames and objects and then use the TIEMultiBitmap to save the multiframe TIFF file?
I hope this is enough explanation and it is understood. If you want a starting point I can post my demo code as I currently have it.
Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development