
--------------------------------------------------------------------------------
-- Desert dot matrix recognition compatible module
--------------------------------------------------------------------------------

---@alias dm_color_offset string
---@alias dm_matrix_string string

---@class dm_box*
---@field word? string Recognized characters
---@field x integer abscissa
---@field y integer vertical coordinate
---@field w integer Width
---@field h integer height

---@class dm*
---@field _VERSION string module version
---@field _AUTHOR string Author
local dm = {}

dm._VERSION = "0.1.2"
dm._AUTHOR = "苏泽"

--- Set the font search directory
--- The default directory is XXT_RES_PATH
---@param dictRootPath string Font directory path
function dm.SetPath(dictRootPath) end

--- Set up a font file corresponding to the number
--- The font file path is relative to the directory set by SetPath
---@param index integer Font number
---@param filename string Font file name
function dm.SetDict(index, filename) end

--- Load a bitmap font from a string to a specified number
---@param index integer Font number
---@param dictString string Bitmap font content
function dm.LoadDict(index, dictString) end

--- Select the currently used font number
---@param index integer Font number
function dm.UseDict(index) end

--- Find a string in a specified range
--- When the area is 0, 0, 0, 0, it means full screen; the color offset string supports multiple groups separated by commas or vertical bars `RRGGBB-DDDDDD`
---@param left number Search area left boundary
---@param top number Search area upper boundary
---@param right number Search area right boundary
---@param bottom number Search area lower boundary
---@param text string Text to be found, multiple targets can be separated by `|`
---@param colorOffset dm_color_offset color offset string
---@param sim number Similarity, usually 0.0 to 1.0
---@return boolean found whether found
---@return integer x Hit the abscissa, return -1 if not found
---@return integer y Hit the vertical coordinate, return -1 if not found
---@return dm_box*[] boxes hit character information
function dm.FindStr(left, top, right, bottom, text, colorOffset, sim) end

--- Identify text in specified area
--- When the area is 0, 0, 0, 0, it means full screen; the color offset string supports multiple groups separated by commas or vertical bars `RRGGBB-DDDDDD`
---@param left number Identify the left boundary of the area
---@param top number Identify the upper boundary of the area
---@param right number Identify the right boundary of the area
---@param bottom number Identify the lower boundary of the region
---@param colorOffset dm_color_offset color offset string
---@param sim number Similarity, usually 0.0 to 1.0
---@return string text Recognition results
---@return dm_box*[] boxes Recognized character information
function dm.Ocr(left, top, right, bottom, colorOffset, sim) end

--- Find a dot matrix string in a specified area
--- When the area is 0, 0, 0, 0, it means full screen; matrixString can contain multiple lines of lattice
---@param left number Search area left boundary
---@param top number Search area upper boundary
---@param right number Search area right boundary
---@param bottom number Search area lower boundary
---@param matrixString dm_matrix_string dot matrix string
---@param colorOffset dm_color_offset color offset string
---@param sim number Similarity, usually 0.0 to 1.0
---@return boolean found whether found
---@return integer x Hit the abscissa, return -1 if not found
---@return integer y Hit the vertical coordinate, return -1 if not found
---@return string text The hit text is not found and an empty string is returned.
---@return dm_box*[] boxes hit character information
function dm.FindMatrix(left, top, right, bottom, matrixString, colorOffset, sim) end

--- Set the font search directory
---@param dictRootPath string Font directory path
function dm.setPath(dictRootPath) end

--- Set up a font file corresponding to the number
---@param index integer Font number
---@param filename string Font file name
function dm.setDict(index, filename) end

--- Load a bitmap font from a string to a specified number
---@param index integer Font number
---@param dictString string Bitmap font content
function dm.loadDict(index, dictString) end

--- Select the currently used font number
---@param index integer Font number
function dm.useDict(index) end

--- Find a string in a specified range
---@param left number Search area left boundary
---@param top number Search area upper boundary
---@param right number Search area right boundary
---@param bottom number Search area lower boundary
---@param text string Text to be found, multiple targets can be separated by `|`
---@param colorOffset dm_color_offset color offset string
---@param sim number Similarity, usually 0.0 to 1.0
---@return boolean found whether found
---@return integer x Hit the abscissa, return -1 if not found
---@return integer y Hit the vertical coordinate, return -1 if not found
---@return dm_box*[] boxes hit character information
function dm.findStr(left, top, right, bottom, text, colorOffset, sim) end

--- Identify text in specified area
---@param left number Identify the left boundary of the area
---@param top number Identify the upper boundary of the area
---@param right number Identify the right boundary of the area
---@param bottom number Identify the lower boundary of the region
---@param colorOffset dm_color_offset color offset string
---@param sim number Similarity, usually 0.0 to 1.0
---@return string text Recognition results
---@return dm_box*[] boxes Recognized character information
function dm.ocr(left, top, right, bottom, colorOffset, sim) end

--- Find a dot matrix string in a specified area
---@param left number Search area left boundary
---@param top number Search area upper boundary
---@param right number Search area right boundary
---@param bottom number Search area lower boundary
---@param matrixString dm_matrix_string dot matrix string
---@param colorOffset dm_color_offset color offset string
---@param sim number Similarity, usually 0.0 to 1.0
---@return boolean found whether found
---@return integer x Hit the abscissa, return -1 if not found
---@return integer y Hit the vertical coordinate, return -1 if not found
---@return string text The hit text is not found and an empty string is returned.
---@return dm_box*[] boxes hit character information
function dm.findMatrix(left, top, right, bottom, matrixString, colorOffset, sim) end

--- Set the font search directory
---@param dictRootPath string Font directory path
function dm.set_path(dictRootPath) end

--- Set up a font file corresponding to the number
---@param index integer Font number
---@param filename string Font file name
function dm.set_dict(index, filename) end

--- Load a bitmap font from a string to a specified number
---@param index integer Font number
---@param dictString string Bitmap font content
function dm.load_dict(index, dictString) end

--- Select the currently used font number
---@param index integer Font number
function dm.use_dict(index) end

--- Find a string in a specified range
---@param left number Search area left boundary
---@param top number Search area upper boundary
---@param right number Search area right boundary
---@param bottom number Search area lower boundary
---@param text string Text to be found, multiple targets can be separated by `|`
---@param colorOffset dm_color_offset color offset string
---@param sim number Similarity, usually 0.0 to 1.0
---@return boolean found whether found
---@return integer x Hit the abscissa, return -1 if not found
---@return integer y Hit the vertical coordinate, return -1 if not found
---@return dm_box*[] boxes hit character information
function dm.find_str(left, top, right, bottom, text, colorOffset, sim) end

--- Find a dot matrix string in a specified area
---@param left number Search area left boundary
---@param top number Search area upper boundary
---@param right number Search area right boundary
---@param bottom number Search area lower boundary
---@param matrixString dm_matrix_string dot matrix string
---@param colorOffset dm_color_offset color offset string
---@param sim number Similarity, usually 0.0 to 1.0
---@return boolean found whether found
---@return integer x Hit the abscissa, return -1 if not found
---@return integer y Hit the vertical coordinate, return -1 if not found
---@return string text The hit text is not found and an empty string is returned.
---@return dm_box*[] boxes hit character information
function dm.find_matrix(left, top, right, bottom, matrixString, colorOffset, sim) end

return dm
