Class Image

All Implemented Interfaces:
Serializable

public class Image extends AbstractElementContent

This content is rendered as an image.

Example:

BufferedImage image= ...; // create an image
new Image(includeSpec, image);

An image content is embedded into HTML as data URL. Currently there is no support to render an image into plain text.

See Also:
  • Constructor Details

    • Image

      public Image(IncludeSpec includeSpec, RenderedImage img, String titleText)
      Create a content with a given include spec and image data.
      Parameters:
      includeSpec - The include spec of the comment
      img - the image data
      titleText - optional title
    • Image

      public Image(IncludeSpec includeSpec, int width, int height, String base64, String titleText)
      Create a content with a given include spec and image data.
      Parameters:
      includeSpec - The include spec of the comment
      width - mandatory width
      height - mandatory height
      base64 - mandatory base64 data
      titleText - optional title
  • Method Details

    • getBase64

      public String getBase64()
    • getTitleText

      public String getTitleText()
    • setMargin

      public void setMargin(int marginHorizontal, int marginVertical)
      Set margin.
      Parameters:
      marginHorizontal - left and right margin in pixels
      marginVertical - top and bottom margin in pixels
    • isInlineContent

      public boolean isInlineContent()
      Specified by:
      isInlineContent in class Content
      Returns:
      true
      See Also:
    • toString

      public String toString(String prefix)
      Description copied from class: Content
      This method is for debugging purposes.
      Overrides:
      toString in class Content
      Parameters:
      prefix - If the output has multiple lines, prefix specifies the indentation of the subsequent lines.
      Returns:
      a string representation of the content and it's internal structure.
      See Also:
    • hashCode

      public int hashCode()
      implements the contract of Object.hashCode().
      Overrides:
      hashCode in class Content
      See Also:
    • equals

      public boolean equals(Object obj)
      implements the contract of Object.equals(Object).
      Overrides:
      equals in class Content
    • renderHtmlImpl

      public void renderHtmlImpl(StringBuilder sb, IncludeInfo includeInfo, RenderContext ctx, boolean useJavascript)
      Description copied from class: Content
      render content to HTML. This method is meant to be overriden by subclasses.
      Specified by:
      renderHtmlImpl in class Content
      Parameters:
      sb - HTML code result
      includeInfo - controls, which content to be rendered.
      ctx - render context
      useJavascript - if true, the generated HTML code will contain Javascript
      See Also:
      • de.hsh.graja.util.comment.Content#renderHtml(StringBuilder, IncludeInfo, RenderContext)
    • renderPlainImpl

      public void renderPlainImpl(StringBuilder appender, IncludeInfo includeInfo, RenderContext ctx)
      Description copied from class: Content
      render content to plain text. This method is meant to be overriden by subclasses.
      Specified by:
      renderPlainImpl in class Content
      Parameters:
      appender - plain text result
      includeInfo - controls, which content to be rendered.
      ctx - render context (unused).
      See Also: