Loading an Image or a Sprite and animating it is trivial.

You can load using XModem/YModem or whatever via USB / Serial

You can store an image or sprite "as is" and use PlotColumn (x, y,
column8pixels) for mono screen from EEPROM.

You can use TIF encoding to save space (simple and works well on
boolean ink mono).

Existing Linux/Windows tools can make the raw byte array or Tiff
encoded file. TIFF is what faxes use to compress transmission, it's
line based run length encoding.

Colour is hugely more costly in storage (8x for palette based and 24x
for raw RGB and 48x if you have RGBAZ!)

Animating an 8x8 sprite (and "actors" and "maps" made of tiled sprites
is easy too). You don't use XOR, which is slow.


I think the best way to have a run time scale-able clock, panel meter
arcs / VU meters and such is a procedure that generates XY coordinate
for Radius and angle. This uses a lookup table to avoid sin and cos.
you only need store one 1/4 of a circle. 15 words for 6 degree
resolution. 30, = 3, 45 = 2 and 90 words ROM for 1 degree.
procedure PolarToCartesian(byte in radius, byte in angle, byte out
xPos, byte out yPos).

this only works for up to a 256x256 display. For larger displays you
need word. Infact my existing routines may be limited to 128x128
graphic. Just change bytes or sbytes to words or sword for up to 32768
x 32768.

For example if a clock is 29 radius for dial, 27 for second hand, 10
long  for hour hand and  16 long for minute hand

 the minute hand is  (3 o'clock/15 minutes is zero degrees, 6pm/30mins
= 90 degrees)
--code to update scaled minute hand
-- erase at old position, using global xhPos yhPos, xmPos etc
DrawLine (clockXcentre, clockYcentre,clockXcentre+xhPos, clockYcentre
+yhPos, false)
DrawLine (clockXcentre, clockYcentre,clockXcentre+xmPos, clockYcentre
+ymPos, false)
DrawLine (clockXcentre, clockYcentre,clockXcentre+xsPos, clockYcentre
+ysPos, false)
-- update hrs, mins, sec...

--- recaluculate with new time...
PolarToCartesian(hrsHandLength, hrs*5-15, xhPos, yhPos)
PolarToCartesian(minHandLength, minutes-15, xmPos, ymPos)
PolarToCartesian(sec HandLength, seconds-15, xsPos, ysPos)
DrawLine (clockXcentre, clockYcentre,clockXcentre+xhPos, clockYcentre
+yhPos, true)
DrawLine (clockXcentre, clockYcentre,clockXcentre+xmPos, clockYcentre
+ymPos, true)
DrawLine (clockXcentre, clockYcentre,clockXcentre+xsPos, clockYcentre
+ysPos, true)

The PolarToCartesian is a lookup table and cos/sin are 90 degrees out
of phase. You only need 90 degrees of table of "sin"
it then does two lookups, one for cos and one for sin (for the one
angle but 90 degrees offset) and two multiplications.. we then take
only MSB of the radius * sin and radius * cos for X and Y..

It might even be LESS code than my static 60 element case statement
for each hand!

The dots and spots calculated the same way at in DrawClockFace

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to