Template

Wrapper class for images, colors or texts that provides extra informations for detection (mask, scale, rotate, grayscale, threshold,...)

Constructor

Instance of this class can only be created via TemplateBuilder.build() methods.

Static Methods
image
static TemplateBuilder image(value: string)

Return a builder for building image template.

Parameters
value The template's value
Return
TemplateBuilder TemplateBuilder
color
static TemplateBuilder color(value: string)

Return a builder for building color template.

Parameters
value The template's value
Return
TemplateBuilder TemplateBuilder
text
static TemplateBuilder text(value: string)

Return a builder for building text template.

Parameters
value The template's value
Return
TemplateBuilder TemplateBuilder
setDefaultScale
static void setDefaultScale(scale: number)

Set the default scale value that all builder is created with.

Parameters
scale The default scale value.
setDefaultScaleX
static void setDefaultScaleX(scale: number)

Set the default scale x value that all builder is created with.

Parameters
scale The default scale value.
setDefaultScaleY
static void setDefaultScaleY(scale: number)

Set the default scale y value that all builder is created with.

Parameters
scale The default scale value.
Methods
getW
number getW()

Get the width of the template. Might be null if template is not found or this is a text template. Make sure to scale the value if you're gonna use it.

Return
number The template width
getH
number getH()

Get the height of the template. Might be null if template is not found or this is a text template. Make sure to scale the value if you're gonna use it.

Return
number The template height
load
Template load(reload: bool)

Eager load the template into cache. This is done automatically if you do any detection on it.

Parameters
reload true to force reload the template even if it already exists in Cache
Return
Template This Template instance
clear
Template clear()

Clear the template from Cache.

Return
Template This Template instance
mutate
TemplateBuilder mutate()

Return a new builder instance with all of this template properties set.

Return
TemplateBuilder TemplateBuilder

© 2024 - Macrorify by KoK-CODE