FS#9710 - Draw numbers from a bmp strip in the WPS

Attached to Project: Rockbox
Opened by Jonathan Gordon (jdgordon) - Thursday, 25 December 2008, 05:37 GMT
Last edited by Jonathan Gordon (jdgordon) - Thursday, 03 June 2010, 04:16 GMT
Task Type Patches
Category Themes
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Version 3.1
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


This patch adds a new tag to the WPS which will draw the next tag as a combination of numbers from a bmp strip. is a pretty bad example of what it can do. The first line is just converting the number 12345 to images (12345 is text in the wps), the 2nd line is the track complete percent (%px)

ok, how to use it:
First you HAVE to have a bmp strip loaded with %x or %xl. This strip is a verticle strip split into 10 cells.. 0 at the top, 9 at the bottom. They must al be the same height and width. (I've attached my really bad test bmp, test.wps and the patch)

after that, add up to 5 %xn lines in the format "%xn|id|x|y|<next tag>"
where id is the bmp's id, x,y is the x and y pixel coordinate (relative to the current viewport) to start drawing in.
<next tag> MUST be immediately after the last |, NO SPACES!
There is some limitation on which tags will work and which wont, but anything which will ordinarily display a number should work, and some conditionals will work also.

Like in the display, you can use this to draw a static number (although i'm not ure why you would want to?)

Lastly... Llorean has suggested I add the ':' character to the strip... I'm happy to do that if its going to be useful, and a few other chars if needed. I dont want to add too many though (and I'm not going to add any letters... this is not a multifont replacement)

let me know what you think
This task depends upon

Closed by  Jonathan Gordon (jdgordon)
Thursday, 03 June 2010, 04:16 GMT
Reason for closing:  Out of Date
Additional comments about closing:  multifont is better!
Comment by Jonathan Gordon (jdgordon) - Thursday, 25 December 2008, 05:47 GMT
hmm... it looks like this is going to need some thought as to how to handle tokens that return numbers proberly... just had a look at the volume tag and I'm pretty sure this wont work at all for it, ideas welcome
Comment by Jonathan Gordon (jdgordon) - Friday, 26 December 2008, 03:12 GMT
updated patch and text.wps.

format: %dn|n|m|x|y|abc
n is the bmp strip number/letter to use.
m is the max number of chars to draw (Always drawn right justified
x is the x pixel to start drawing at (viewport relative)
y is the y pixel to start drawing at (viewport relative)
abc is up to 7 extra chars in the order they appear at the end of the bmp strip
Comment by Jonathan Gordon (jdgordon) - Friday, 26 December 2008, 06:22 GMT
new version... sacrifice 8 bytes per number grouping so the bmp is redrawn only if the number to draw changes.

edit2: reupped the diff.. this one actually works
Comment by Jonathan Gordon (jdgordon) - Saturday, 27 December 2008, 14:28 GMT
hopefully final version.. this one draws the bmp using the transparent bmp drawing function on 16bit lcds so the 2 magic colours work (255,255,0 and 255,0,255)
Comment by Humberto Santana (hhannah) - Wednesday, 14 January 2009, 22:41 GMT
I've tried this patch for both the iPod video and the iPod mini, and in both cases I get a data abort crash when the .wps containing the %xn tag is loading. Also, in both cases the patch works fine when used for the simulator build.