pad
Images

The examples so far have been almost identical to the corresponding HTML. Here's an example that begins to suggest how RTML is different:

Big-Greeting ()
TITLE "A Louder Greeting"
BODY
  IMAGE source RENDER text "Hello World!"
                      text-color red
                      font-size 40
This will yield a page containing the words "Hello World!" rendered as an image. Instead of the screen font, the greeting will appear in bright red 40-point Helvetica characters.

Now we begin to see how RTML goes beyond HTML. In HTML, all you can really say to specify an image is the filename--and before you can do that, you have to create the image, usually in a separate program like Photoshop. Here you just say in the template what kind of image you want, and it gets generated when the page is generated.

In this example, we see two new operators, IMAGE and RENDER. The IMAGE operator inserts a reference to an image in the current page. It can take several arguments, though in this case only one is made explicit.

The source argument of IMAGE tells which image to display. In this case the source argument is a call to RENDER. The RENDER operator generates an image. In this case three of its arguments are specified: the text, its color, and the size. (The font defaults to Helvetica.)

The text-color argument of RENDER is an example of something new: a predefined constant. For convenience, certain names are predefined to refer to commonly used objects, and red is defined to represent the color that could also be expressed as

COLOR red 255
      green 0
      blue 0




Sales: 1-888-4-VIAWEB or sales@viaweb.com.
Support: 1-617-876-9678 or support@viaweb.com.