Class HandwritingGenerator

java.lang.Object
com.myscript.iink.HandwritingGenerator
All Implemented Interfaces:
AutoCloseable

public class HandwritingGenerator extends Object implements AutoCloseable
Represents a handwriting generator that provides a way to generate handwritten content from source parameters (label, writing profile and formatting).
Since:
4.1
  • Method Details

    • finalize

      protected void finalize() throws Throwable
      Overrides:
      finalize in class Object
      Throws:
      Throwable
    • close

      public final void close()
      Specified by:
      close in interface AutoCloseable
    • isClosed

      public final boolean isClosed()
      Tells whether the close() method has been called. Once an object is closed any method will throw IllegalStateException.
      Returns:
      true if this object is closed.
    • setListener

      public final void setListener(@Nullable @Nullable IHandwritingGeneratorListener listener)
      Sets the specified listener to this handwriting generator.
      Parameters:
      listener - the listener to be added, or null to unset the previous one.
      Throws:
      IllegalStateException - when this handwriting generator is closed.
    • createHandwritingProfileBuilder

      @NotNull public final @NotNull HandwritingProfileBuilder createHandwritingProfileBuilder()
      Create a new handwriting profile builder.
      Returns:
      the newly created handwriting profile builder.
      Throws:
      IllegalStateException - when this handwriting generator is closed.
      IllegalStateException - when the handwriting profile builder cannot be created.
    • getSupportedContentTypes

      @NotNull public final @NotNull String[] getSupportedContentTypes()
      Returns the types of content that can be generated.
      Returns:
      an array of the supported content types.
      Throws:
      IllegalStateException - when this handwriting generator is closed.
    • start

      public final void start(@NotNull @NotNull String type, @NotNull @NotNull HandwritingProfile profile, @Nullable @Nullable ParameterSet overrideConfiguration)
      Starts a handwriting generation using the specified writing profile.
      Parameters:
      type - the type of the generated handwritten content.
      profile - the handwriting profile used to generate the handwritten content.
      overrideConfiguration - the extra configuration used for this handwriting generation.
      Throws:
      IllegalStateException - when this handwriting generator is closed.
      IllegalArgumentException - if the type is not a supported content type.
      IllegalStateException - when this handwriting generator is not idle (see isIdle()).
      IllegalStateException - when the handwriting generator resource is not found in the search path of the configuration manager (\"configuration-manager.search-path\").
      IllegalArgumentException - when overrideConfiguration is invalid.
    • getSupportedMimeTypes

      @NotNull public final @NotNull MimeType[] getSupportedMimeTypes(@NotNull @NotNull String type)
      Returns the input formats supported by the handwriting generation for the given content type.
      Parameters:
      type - the type of the generated handwritten content.
      Returns:
      an array of the supported mime types.
      Throws:
      IllegalStateException - when this handwriting generator is closed.
      IllegalArgumentException - when type is not a supported content type.
    • add

      public final void add(@NotNull @NotNull String label, @NotNull @NotNull MimeType type)
      Adds text in the current handwriting generation.
      Parameters:
      label - the input label that the generated handwritten content must match.
      type - The mime type describing the format of the label.
      Throws:
      IllegalStateException - when this handwriting generator is closed.
      IllegalArgumentException - when type is not supported by this handwriting generator.
      IllegalStateException - when a handwriting generation has not been started (see start()).
    • end

      public final void end()
      Tells the handwriting generation to not wait for more text to add.
      Throws:
      IllegalStateException - when this handwriting generator is closed.
      IllegalStateException - when a handwriting generation has not been started (see start() and add()).
    • cancel

      public final void cancel()
      Cancels the ongoing handwriting generation if any.
      Throws:
      IllegalStateException - when this handwriting generator is closed.
    • isIdle

      public final boolean isIdle()
      Checks whether a generation is ongoing.
      Returns:
      true if there are no pending operations.
      Throws:
      IllegalStateException - when this handwriting generator is closed.
    • waitForIdle

      public final void waitForIdle()
      Waits until ongoing generation is over.
      Throws:
      IllegalStateException - when this handwriting generator is closed.
    • getResult

      @NotNull public final @NotNull HandwritingResult getResult()
      Returns the cumulative result of the latest handwriting generation.
      Returns:
      the latest generated handwriting result.
      Throws:
      IllegalStateException - when this handwriting generator is closed.
      IllegalStateException - when a handwriting generation is not idle (see isIdle()).