Search code examples
halcon

how do I draw text on image


I found that Halcon only defines disp_text, but this function only displays the text in a window. I know we can use GDI+ or other gaphics API,such as opengl, but it's not "nature". I wonder if I'm missing some details, thank you!


Solution

  • Using

    Row:=10
    Column:=10
    Text:='Some Text'
    dev_get_window(CurrentWindowHandle)
    set_tposition(CurrentWindowHandle, Row, Column)
    write_string(CurrentWindowHandle, Text)
    dump_window_image(image, CurrentWindowHandle)
    

    As pointed out by Christoph Rackwitz, dump_window_image works for that. its not a straight forward solution, but it does its job. Thanks to Chris at this point, because i was just looking for that answer.