home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-21 | 2.9 KB | 81 lines | [TEXT/ttxt] |
- --<<<
- -- Filename:
- -- PAINTING.SX
-
- -- Other Files Required:
- -- GAUGUIN.BMP bitmap image (400 x 300)
-
- -- Purpose:
- -- Intended to be a simple title which stores bitmaps in a separate library file.
- -- A more elaborate version of this program is available as "paintngs.sx"
-
- -- Specialized Classes: (none)
-
- -- Instructions to User:
- -- 1. Open this script. It will create a title file called PAINTING.SXT.
- -- 2. Open the library script. It will create a library file called PAINTING.SXL,
- -- and its picture will appear in the title, and close the title.
- -- 3. Quit ScriptX. Open the newly created title container called PAINTING.SXT
- -- from the operating system. It should open up the title container and
- -- library container, and display the painting.
-
- -- Authors:
- -- Erik Neumann, Douglas Kramer
-
- ------------------------------------------------------------------------------
- -- CREATE THE TITLE **********************************************************
- ------------------------------------------------------------------------------
- -- Create the window
- global myWindow := new Window boundary: (new Rect x1: 0 y1: 40 x2: 400 y2: 300)
- myWindow.name := "Gauguin"
- show myWindow
-
- ------------------------------------------------------------------------------
- -- Create and append a TwoDShape to the window
- global myShape := new TwoDShape
- append myWindow myShape
-
- ------------------------------------------------------------------------------
- -- Create the title container and add the window to it
- global tc := new TitleContainer dir:theScriptDir path:"painting.sxt" \
- name:"Painting Title"
- append tc myWindow
-
- -- Define the startup action
- tc.startupAction := (
- -- Load all objects in the title container
- tc -> forEach tc load undefined
-
- -- Get the library container
- local myLC := chooseOne theOpenContainers \
- (v a -> v.name = "Painting Library") 0
-
- -- Assign the first bitmap in the library to the target
- -- of the 2D shape in the frontmost window
- tc.windows[1][1].target := myLC[1]
- )
-
- ------------------------------------------------------------------------------
- -- CREATE THE LIBRARY ********************************************************
- ------------------------------------------------------------------------------
-
- function getPict fileName -> (
- local myStream := getStream theScriptDir fileName @readable
- local myimage := importMedia theImportExportEngine myStream @image @dib \
- @bitmap colormap:defaultcolormap
- myimage
- )
-
- global p1 := getPict "GAUGUIN.BMP"
-
- ------------------------------------------------------------------------------
- -- Create the library, and append the picture to it
- -- Note that this library uses the title container tc defined previously
- global lc := new LibraryContainer dir:theScriptDir path:"painting.sxl" \
- name:"Painting Library" user:tc
- append lc p1
-
- -- Close the title container and then the library container
- close tc
- close lc
-