Class ImageConfiguration

java.lang.Object
com.deltaxml.docbook.config.ImageConfiguration

public class ImageConfiguration extends Object
Contains parameters managing image comparison.
  • Constructor Details

    • ImageConfiguration

      public ImageConfiguration()
      Creates a new ImageConfiguration instance. Contains parameters managing image comparison.
    • ImageConfiguration

      public ImageConfiguration(boolean imageCompareEnabled)
      Creates a new ImageConfiguration instance, setting the value of the imageCompareEnabled parameter. Contains parameters managing image comparison.
      Parameters:
      imageCompareEnabled - the value of the imageCompareEnabled parameter.
  • Method Details

    • isImageCompareEnabled

      public boolean isImageCompareEnabled()
      Gets the value of the imageCompareEnabled parameter.
      Returns:
      the value of the imageCompareEnabled parameter
    • setImageCompareEnabled

      public void setImageCompareEnabled(boolean value)

      Whether the actual images used will be compared rather than the string value of the location (fileref attribute) of the imagedata.

      This can mean that even though the fileref has not changed the image will be marked as a change if it resolves to different images within the context of A or B. Similarly if the fileref has changed but resolves to the same image within the context of A or B it will not be marked as a change. The xml:base of both input files will be used to resolve the fileref to an absolute location. If no xml:base is given the XPAth base-uri() function is used. The resolved locations from A and B will then be compared for string equality. If they are the same then the fileref will not be marked as a change, if they are different then the URIs will be opened using URL.openStream() and byte-wise comparison of the images will be done. If any problem occurs then the images will be marked as changed, otherwise the result of the byte-wise comparison will be used to determine whether the image is marked as changed.

      Parameters:
      value - the value to set for the imageCompare parameter
      See Also:
    • isShowImageChangesAtMediaObjectLevel

      public boolean isShowImageChangesAtMediaObjectLevel()
      Gets the value of the showImageChangesAtMediaObjectLevel parameter.
      Returns:
      the value of the showImageChangesAtMediaObjectLevel parameter
    • setShowImageChangesAtMediaObjectLevel

      public void setShowImageChangesAtMediaObjectLevel(boolean value)

      If setImageCompareEnabled(boolean) is set to true and determines that images have changed, show the changes as changes to the containing mediaobject.

      By default, image changes are tracked as changes to the fileref attribute of the DocBook imagedata tag. Since changes to attributes are difficult to show in docbook, it may be preferable to show the change at the level of the containing mediaobject or inlinemediaobject by cloning them and showing the A and B versions 'side by side' in the result document.

      Default: false

      Parameters:
      value - the value to set for the showImageChangesAtMediaObjectLevel parameter
    • isShowImageChangesAtMediaObjectParentLevel

      public boolean isShowImageChangesAtMediaObjectParentLevel()
      Gets the value of the showImageChangesAtMediaObjectParentLevel parameter.
      Returns:
      the value of the showImageChangesAtMediaObjectParentLevel parameter
    • setShowImageChangesAtMediaObjectParentLevel

      public void setShowImageChangesAtMediaObjectParentLevel(boolean value)

      Sets image changes at media object parent level. This only works if a value for media object parent list has a matching element.

      Parameters:
      value - the value to set for the boolean parameter
      See Also:
    • getMediaObjectParentsList

      public String getMediaObjectParentsList()
      Gets the value of the mediaObjectParentsList parameter.
      Returns:
      the value of the mediaObjectParentsList parameter
    • setMediaObjectParentsList

      public void setMediaObjectParentsList(String value)

      Sets the comma and/or space separated list of media object parents using Clark notation. Only active when setShowImageChangesAtMediaObjectParentLevel(boolean) is set to true.

      This parameter defines which media object parents are allowed by DocBook documentation.

      Parameters:
      value - the value to set for the mediaObjectParentsList parameter
      Throws:
      IllegalArgumentException - if the value is null
    • getOutputImageRefForm

      public OutputImageRefForm getOutputImageRefForm()
      Gets the value of the outputImageRefForm parameter.
      Returns:
      the value of the outputImageRefForm parameter
    • setOutputImageRefForm

      public void setOutputImageRefForm(OutputImageRefForm value)

      If setImageCompareEnabled(boolean) is set to true this may change the form of fileref attributes of imagedata elements. If set to OutputImageRefForm.SOURCE the value will be as it appears in the source A or B document. If set to OutputImageRefForm.ABSOLUTE the value will be the absolute location used to calculate whether the image has changed. This should mean that for filesystem filerefs at least the images should be visible in the result document. See setImageCompareEnabled(boolean) (boolean)} for more detail on how the absolute form is calculated.

      Default: OutputImageRefForm.absolute

      Parameters:
      value - the value to set for the outputImageRefForm parameter
      Throws:
      IllegalArgumentException - if the value is null
    • getOutputImageRefFavourSourceDoc

      public OutputImageRefFavourSourceDoc getOutputImageRefFavourSourceDoc()
      Gets the value of the outputImageRefFavourSourceDoc parameter.
      Returns:
      the value of the outputImageRefFavourSourceDoc parameter
    • setOutputImageRefFavourSourceDoc

      public void setOutputImageRefFavourSourceDoc(OutputImageRefFavourSourceDoc value)

      If setImageCompareEnabled(boolean) is set to true and there are no differences in the A and B images, this determines which of the source Documents, A or B, will be used to set the value of the result fileref. This value will then be used as is or be turned into an absolute value depending on the value passed to setOutputImageRefForm(OutputImageRefForm) Even if there are no differences A and B can still point to different files, so there is still a choice of the value used to derive the result.

      Parameters:
      value - the value to set for the outputImageRefFavourSourceDoc parameter
      Throws:
      IllegalArgumentException - if the value is null
      See Also:
    • getImageComparisonGranularity

      public ImageComparisonGranularity getImageComparisonGranularity()

      Gets the current image comparison granularity.

      Returns:
      the current image comparison granularity
      See Also:
    • setImageComparisonGranularity

      public void setImageComparisonGranularity(ImageComparisonGranularity imageComparisonGranularity)
      Sets the ImageComparisonGranularity at which the differences between two images will be represented. The default is ImageComparisonGranularity.DETAILED_ADJACENT.
      Parameters:
      imageComparisonGranularity - the value to set for the imageComparisonGranularity parameter
    • getInputAMarkupStyle

      public String getInputAMarkupStyle()
      Gets the Input A Image comparison markup style used for image comparison results.
      Returns:
      the Input A Image markup style.
    • setInputAMarkupStyle

      public void setInputAMarkupStyle(String inputAMarkupStyle)
      Sets the Input A image markup style setting for binary image comparison results. The default is "red" and an image color can be provided as color names, RGB or RGBA values, HEX values, HSL or HSLA values.
      Parameters:
      inputAMarkupStyle - the Input A image markup style.
    • getInputBMarkupStyle

      public String getInputBMarkupStyle()
      Gets the Input B Image comparison markup style used for image comparison results.
      Returns:
      the Input B Image markup style.
    • setInputBMarkupStyle

      public void setInputBMarkupStyle(String inputBMarkupStyle)
      Sets the Input B image markup style setting for binary image comparison results. The default is "green" and an image color can be provided as color names, RGB or RGBA values, HEX values, HSL or HSLA values.
      Parameters:
      inputBMarkupStyle - the Input B image markup style.