Example 1
This example shows how to convert an image, burn in annotation marks, and save the image under a new file name.
void CImgEdit1Dlg::OnBurnin()
{
// Converts an image, burns in annotation marks and saves
// it under a new file name
#define ALL_MARKS 0
#define WINDOWS_DEFAULT 2
// If you wish to save color annotations on a black
// and white image you must first convert the
// image to a non black and white type
VARIANT vRepaint; V_VT(&vRepaint) = VT_BOOL; V_BOOL(&vRepaint) = TRUE;
VARIANT evt; V_VT(&evt) = VT_ERROR; // set to default
ImgEdit1.ConvertPageType(5,vRepaint); // wiPageTypePal8, True
// Save all marks in their original colors
ImgEdit1.BurnInAnnotations(ALL_MARKS, WINDOWS_DEFAULT,evt);
// Color Burn in always converts to RGB24. To save disk space,
// save the image as an 8 bit palettized image
VARIANT vFileType; V_VT(&vFileType) = VT_I2; // set FileType for saveas
VARIANT vPageType; V_VT(&vPageType) = VT_I2; // set to PageType for saveas
V_I2(&vFileType) = 1;
V_I2(&vPageType) = 5;
// wiFileTypeTIFF, wiPageTypePal8
ImgEdit1.SaveAs("C:\\imgsave\\annotate.tif",vFileType,vPageType,evt,evt,evt);
}
Example 2
This example shows the options that are available for file linking/copying when performing a SaveAs of an Imaging 1x server document.
void CImgEdit2Dlg::OnFilelinking()
{
// An example of the options available for file linking/
// copying when performing a SaveAs of a 1x server document.
VARIANT evt; V_VT(&evt) = VT_ERROR; // set to default for saveas
// Option 1
// Request files associated with the document being
// saved be copied to new files in a location to be
// specified. This is the default and in most cases
// the preferred method to use.
ImgAdmin1.SetForceFileLinking1x(FALSE);
// To specify location of the new files, use the Admin
// control FileStgLoc1x property
ImgAdmin1.SetFileStgLoc1x("Image://servername\\new_images:");
// Displayed 1x document is saved to a new document name
// Associated image files will be copied to new randomly
// generated file names in directory specified
ImgEdit1.SaveAs ("Image://servername\\doc_db:\\CABNAME\\DRAWER\\FOLDER\\NEW DOC",
evt,evt,evt,evt,evt);
// Option 2
// Request files associated with the document being
// saved reference the original files. This results in
// multiple documents accessing the same files -- could
// be useful to prevent rewrites of optical disk files.
ImgAdmin1.SetForceFileLinking1x(TRUE);
// Displayed 1x document is saved to a new document name
// but original image files are linked to the new document.
ImgEdit1.SaveAs ("Image://servername\\doc_db:\\CABNAME\\DRAWER\\FOLDER\\NEW DOC",
evt,evt,evt,evt,evt);
}