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 void
Adds text in the current handwriting generation.final void
cancel()
Cancels the ongoing handwriting generation if any.final void
close()
final @NotNull HandwritingProfileBuilder
Create a new handwriting profile builder.final void
end()
Tells the handwriting generation to not wait for more text to add.protected void
finalize()
final @NotNull HandwritingResult
Returns 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 boolean
isClosed()
Tells whether theclose()
method has been called.final boolean
isIdle()
Checks whether a generation is ongoing.final void
setListener
(@Nullable IHandwritingGeneratorListener listener) Sets the specified listener to this handwriting generator.final void
start
(@NotNull String type, @NotNull HandwritingProfile profile, @Nullable ParameterSet overrideConfiguration) Starts a handwriting generation using the specified writing profile.final void
Waits until ongoing generation is over.
-
Method Details
-
finalize
-
close
public final void close()- Specified by:
close
in interfaceAutoCloseable
-
isClosed
public final boolean isClosed()Tells whether theclose()
method has been called. Once an object is closed any method will throwIllegalStateException
.- Returns:
true
if this object is closed.
-
setListener
Sets the specified listener to this handwriting generator.- Parameters:
listener
- the listener to be added, ornull
to 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 thetype
is 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
- whenoverrideConfiguration
is 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
- whentype
is 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
- whentype
is 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:
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
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()
).
-