Pages into dmview views (.dmvs): a design made in HTML and CSS - or any
format a dmvsi converter knows
- becomes a view, with its fonts and images next to it.
page.html ──(dmvsi: dmvs_html)──► document ──(libtodmvs)──► page.dmvs + fonts + images ──(dmod)──► .dmv, .dmvf, .dmvi
| Module | Kind | Role |
|---|---|---|
libtodmvs |
Library | Writes the view of a dmvsi document; converts a file (dmvsi + writing) |
todmvs |
Application | The command-line tool on top of libtodmvs |
Both run on a PC (at build time) and on a device.
- A group becomes a
BOXonly when it clips, fades (OPACITY) or scrolls (SCROLL); the others are flattened into their box.OPAQUEwhen the box's first shape covers it with opaque pixels. - What is outside the screen (or its box) is left out - e.g. the windows of a page that slide in with JavaScript.
- Colors are written in place, gradients declared once each.
- Shadows and blurs, which dmview does not draw, are painted with
gradients: the blur's falloff as their stops, on pieces around the shape
(bands straight out, radial corners), only outside the element casting it
and only as far as it is visible; a blurred circle is one
CIRCLEwith the exact falloff of a blurred disk. - Text is
TEXTon its baseline, in a.fontof the size and the letter spacing it is drawn in. - Behaviour: the document's variables are
.vars; a group bound to one is aBOXat$x/$yor withOPACITY $a(kept while it is off the screen - a window that slides in), a clicked one hasON CLICK; a handler is a label ofSET,TOGGLEand jumps. An animated variable moves each frame (.timer 16) along its CSS easing - acubic-beziermade 16 lines. A group shown on conditions is jumped over otherwise (JNE $v, 1, ...,$box.pressedfor a pressed look). - A clip as large as what clips already (the screen) is no box; a box that
moves stays
OPAQUE- dmview draws nothing beneath it. - A translucent fill right over an opaque one of its rectangle is one opaque fill of both: dithered on RGB565, where a translucent gradient bands.
Next to the view the writer puts what dmod's DMOD_ASSETS_PATHS makes the
rest of from: a copy of every font file the view draws with, and its .ini
with a section for each size and letter spacing - with only the characters
the view's text uses (a clock in 48 px is just its digits and the colon, not a
whole font). An .ini that is there already keeps its other sections, so
several views can share a directory. Images are copied too, with an .ini
of a section for each size (and blur) a view draws them at - photo at its
own size, photo-140x93 scaled, photo-480x320-b20 scaled and blurred -
and named in the view as the .dmvi dmod converts each section into
(dmview draws images unscaled: placed in their rectangle and clipped).
The output directory is ready to be one of DMOD_ASSETS_PATHS.
todmvs [options] PAGE
-o OUTPUT the .dmvs file (default: PAGE with .dmvs in place of its extension)
-r ID the element the view is made of (default: the whole page)
-s WIDTHxHEIGHT the screen the page is laid out for (default: the converter's)
-n NAME the view's name (default: the page's file name)
-m FROM=TO a resource is elsewhere: a URL, or its beginning ending in '/', and the
file, or directory, it is (style sheets, fonts, images); repeatable
--no-assets write only the view - no fonts, no images next to it
-q print nothing but errors
A page made with CDNs - Tailwind's Play CDN, Font Awesome, Google Fonts:
todmvs ui.html -r screen -o views/ui.dmvs \
-m https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/=fontawesome/ \
-m https://fonts.googleapis.com/css2=fonts/inter.css(fonts/inter.css: the @font-face rules of the font files you have.)
See docs/api-reference.md for the library.
mkdir -p build
cd build
cmake ..
cmake --build .Pass -DDMOD_DIR=/path/to/local/dmod to build against a local dmod checkout.
The tests write documents made in code and assemble the views with libtodmv:
cd build
ctest --output-on-failureMIT - see LICENSE.