Package com.myscript.iink
Class HandwritingGenerator
java.lang.Object
com.myscript.iink.HandwritingGenerator
- All Implemented Interfaces:
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 Summary
Modifier and TypeMethodDescriptionfinal voidAdds text in the current handwriting generation.final voidcancel()Cancels the ongoing handwriting generation if any.final voidclose()final @NotNull HandwritingProfileBuilderCreate a new handwriting profile builder.final voidend()Tells the handwriting generation to not wait for more text to add.protected voidfinalize()final @NotNull HandwritingResultReturns the cumulative result of the latest handwriting generation.final @NotNull String[]Returns the types of content that can be generated.final @NotNull MimeType[]getSupportedMimeTypes(@NotNull String type) Returns the input formats supported by the handwriting generation for the given content type.final booleanisClosed()Tells whether theclose()method has been called.final booleanisIdle()Checks whether a generation is ongoing.final voidsetListener(@Nullable IHandwritingGeneratorListener listener) Sets the specified listener to this handwriting generator.final voidstart(@NotNull String type, @NotNull HandwritingProfile profile, @Nullable ParameterSet overrideConfiguration) Starts a handwriting generation using the specified writing profile.final voidWaits until ongoing generation is over.
-
Method Details
-
finalize
-
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
isClosed
public final boolean isClosed()Tells whether theclose()method has been called. Once an object is closed any method will throwIllegalStateException.- Returns:
trueif this object is closed.
-
setListener
Sets the specified listener to this handwriting generator.- Parameters:
listener- the listener to be added, ornullto unset the previous one.- Throws:
IllegalStateException- when this handwriting generator is closed.
-
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
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 thetypeis not a supported content type.IllegalStateException- when this handwriting generator is not idle (seeisIdle()).IllegalStateException- when the handwriting generator resource is not found in the search path of the configuration manager (\"configuration-manager.search-path\").IllegalArgumentException- whenoverrideConfigurationis invalid.
-
getSupportedMimeTypes
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- whentypeis not a supported content type.
-
add
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 thelabel.- Throws:
IllegalStateException- when this handwriting generator is closed.IllegalArgumentException- whentypeis not supported by this handwriting generator.IllegalStateException- when a handwriting generation has not been started (seestart()).
-
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 (seestart()andadd()).
-
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:
trueif 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
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 (seeisIdle()).
-