Script Library: 1219 scripts
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Documentation for: view-image.r


Usage document for %view-image.r

1. Introduction to %view-image.r

1.1. Including %view-image-name.r and %view-image-name2.r

view-image.r is an introduction to REBOL/View and image display.

view-image-name.r and view-image-name2.r highlight how easily text can added to images, including over an image.

2. view-image At a Glance

This script needs a %bay.jpg image file in the current directory.

There are a few ways of getting this file, best to go to the source

 >> write/binary %bay.jpg read/binary http://www.rebol.com/view/bay.jpg
 
or you can cache it...
 >> img: load-thru/binary http://www.rebol.org/view/bay.jpg
 
Which will leave a local copy for later use, in a (little) known area called the sandbox or more specifically, view-root. You can now access this image as view-root/public/www.rebol.com/view/bay.jpg

Once you have the image the script is ready to run, just do it.

>> do %view-image.r
 

view-image.png

The above image was created running REBOL/View 2.7.5.4.2 GNU/Linux 4.0, KDE Desktop. It is a collection of three screenshots; %view-image.r, %view-image-name.r and %view-image-name2.r.

3. Using %view-image.r

Requires REBOL/View

3.1. Running %view-image.r

Prepare a local copy of %bay.jpg and then

 >> do %view-image.r
 

4. What you can learn

This script is an introduction to the view and layout functions.
Please see the REBOL/View Developer's Guide 

Both REBOL/Core and REBOL/View are available
free of charge from www.rebol.com 

REBOL/View allows for very simple layouts.

One point is that layout defaults to placing each element from top to bottom, or vertical direction. This functionality can easily be overridden with the layout keyword across, to place elements left to right, or horizontal direction. See the Developer's Guide for more information. The composite screenshot was produced using across.

4.1. View faces have many facets.

Every face in a REBOL/View display has a number of different facets. Each face includes an image field, and also a text field. If you have both, the text shows up on top. This is shown with the %view-image-name2.r script. Because no seperate text field is created, the single face defined has both an image and text set when it is created by the layout function. VID builds the face to display both.

5. What can break

You need to create an exact copy of the %bay.jpg binary file.

Well, REBOL/Core will not have the view or layout functions defined. You will need to start up REBOL/View.

6. Credits

%view-image.r Author: Unknown
%view-image-name.r Author: Unknown
%view-image-name2.r Author: Unknown
  • The rebol.org Library Team
  • Usage document by Brian Tiffin, Library Team Apprentice, Last updated: 8-Jun-2007