BurnInAnnotations Example VC++

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);
}