textgen: Add image include support for smtextgen.

Instead of generating text and image parts in separate stages, add
the ability to include an image in the smtextgen command line. This
makes the command line in the Makefile clearer.
This commit is contained in:
Simon Howard 2014-09-07 04:22:09 +00:00
parent 5405104814
commit 9968fe0ed1
2 changed files with 72 additions and 65 deletions

View file

@ -154,8 +154,17 @@ command_line = [
]
for xy, string in args['strings']:
command_line.extend(smallfont.draw_commands_for_text(
string, xy[0], xy[1]))
# Allow special notation to indicate an image file to just draw
# rather than rendering a string.
if string.startswith('file:'):
command_line.extend((
'-draw',
'image over %i,%i 0,0 "%s"' % (
xy[0], xy[1], string[5:]),
))
else:
command_line.extend(smallfont.draw_commands_for_text(
string, xy[0], xy[1]))
command_line.extend((
'-background', BACKGROUND_COLOR,