During loading of Image mark from XML the syntactic and sematic errors can be detected. Algorithm of loading tries to eliminate such errors and loads mark as possible. Structure of embedded image is presented by Data or PagedData elements. For images whose size is less than 256 kilobytes binary data of image is encoded as Base64 string and placed as inner text in Data element. For images with size greater 256 kilobytes the binary stream of image is divided into parts each of which does not exceed 256 kilobytes. Each part is encoded as Base64 string in DataPart element as inner text. DataPart elements are placed in PagedData. In correct state Mark element can contain only one Data or PagedData element. However, XML loading may processes few variants of their combinations. Loading process distinguishes three types of XML damages: broken Base64 encoding, broken image and image may be loaded but with error. If image has minor damages and may be loaded the loading process concerns such images as completly correct. The following rules are applied to XML during loading:
If only one Data or PagedData is present in Mark element and the inner text is incorrect Base64 encoding the ART page is not loaded and ImGearART.LoadPage returns null.
If only one Data or PagedData is present in Mark element and Base64 encoding is valid but image cannot be loaded from this string ART page and Image mark are loaded however, ImGearARTImage.Page member will be null.
When both Data and PagedData are present in Mark element and are valid then Data element is prefered and image will be loaded from Data element.
Loading process loads first Data or PagedData element that contains valid image.
If Data or Paged data with incorrect Base64 encoding string is placed behind valid element with the same tag name the error of XML loading will be eliminated and ART page as well as mark and image will be loaded.
// Setup rectangle for the image mark's location.
ImGearRectangle igRectangle = new ImGearRectangle(10, 10, 100, 100);
// Create image mark using a file "PNGTEST.png".
ImGearARTImage igARTImage = new ImGearARTImage(
igRectangle, "PNGTEST.png"
);
// Add the annotation to the ARTPage.
igARTPage.AddMark(igARTImage, ImGearARTCoordinatesType.IMAGE_COORD);
' Setup rectangle for the image mark's location.
Dim igRectangle AsNew ImGearRectangle(10, 10, 100, 100)
' Create image mark using a file "PNGTEST.png".
Dim igARTImage AsNew ImGearARTImage( _
igRectangle, "PNGTEST.png")
' Add the annotation to the ARTPage.
igARTPage.AddMark(igARTImage, ImGearARTCoordinatesType.IMAGE_COORD)