% from Lucasfilm Ltd. plaiddemo = proc () bwidth: int := int$parse(xdemo_default("plaid", "BorderWidth")) except when not_found, overflow, bad_format: bwidth := 2 end back: x_pixmap := x_display$white() bdr: x_pixmap := x_display$black() plane: int := 1 if x_display$cells() > 2 then begin r, g, b: int := x_parse_color(xdemo_default("plaid", "Border")) bdr := x_pixmap$tile(x_display$alloc_color(r, g, b)) end except when not_found: end cback: string := xdemo_default("plaid", "Background") except when not_found: cback := "" end cfore: string := xdemo_default("plaid", "Foreground") except when not_found: cfore := "" end if string$empty(cback) cand string$empty(cfore) then exit done end pixs: pixellist pixs, plane := x_display$alloc_cells(1, 1, false) back := x_pixmap$tile(pixs[1]) r, g, b: int if string$empty(cback) then r, g, b := x_display$query_color(WhitePixel) else r, g, b := x_parse_color(cback) end x_display$store_color(pixs[1], r, g, b) if string$empty(cfore) then r, g, b := x_display$query_color(BlackPixel) else r, g, b := x_parse_color(cfore) end x_display$store_color(pixs[1] + plane, r, g, b) end except when done: end w: x_window, wid0, hgt0: int := x_cons("plaid", back, bdr, xdemo_geometry(), "=401x476+1+1", 40, 40, bwidth) w.name := "plaid" w.input := UnmapWindow x_window$map(w) w.input := ExposeWindow + UnmapWindow ev: event := x_input$empty_event() nobit: x_bitmap := x_bitmap$none() while true do x_window$clear(w) sx, sy, width, height, bw, ms, wk: int, iw: x_window := x_window$query(w) if width <= 30 cor height <= 30 then x_window$destroy(w) return end width := width / 2 height := height / 2 x: int := 0 y: int := 0 xinc: int := 2 yinc: int := 2 count: int := 0 while count ~= 0 cor ~x_input$pending() do if count = 10 then count := 0 else count := count + 1 end if x ~= 0 cand y ~= 0 then x_window$pix_fill(w, 0, nobit, width - x, height - y, 2 * x, 2 * y, GXinvert, plane) end x := x + xinc if x < 0 cor x >= width - 1 then x := x - 2 * xinc xinc := -xinc end y := y + yinc if y < 0 cor y >= height then y := y - 2 * yinc yinc := -yinc end end x_input$deq(ev) if ev.kind = UnmapWindow then x_input$deq(ev) end end end plaiddemo