|
|
1.1 ! root 1: % from Lucasfilm Ltd. ! 2: ! 3: plaiddemo = proc () ! 4: bwidth: int := int$parse(xdemo_default("plaid", "BorderWidth")) ! 5: except when not_found, overflow, bad_format: bwidth := 2 end ! 6: back: x_pixmap := x_display$white() ! 7: bdr: x_pixmap := x_display$black() ! 8: plane: int := 1 ! 9: if x_display$cells() > 2 ! 10: then begin ! 11: r, g, b: int := x_parse_color(xdemo_default("plaid", "Border")) ! 12: bdr := x_pixmap$tile(x_display$alloc_color(r, g, b)) ! 13: end except when not_found: end ! 14: cback: string := xdemo_default("plaid", "Background") ! 15: except when not_found: cback := "" end ! 16: cfore: string := xdemo_default("plaid", "Foreground") ! 17: except when not_found: cfore := "" end ! 18: if string$empty(cback) cand string$empty(cfore) ! 19: then exit done end ! 20: pixs: pixellist ! 21: pixs, plane := x_display$alloc_cells(1, 1, false) ! 22: back := x_pixmap$tile(pixs[1]) ! 23: r, g, b: int ! 24: if string$empty(cback) ! 25: then r, g, b := x_display$query_color(WhitePixel) ! 26: else r, g, b := x_parse_color(cback) ! 27: end ! 28: x_display$store_color(pixs[1], r, g, b) ! 29: if string$empty(cfore) ! 30: then r, g, b := x_display$query_color(BlackPixel) ! 31: else r, g, b := x_parse_color(cfore) ! 32: end ! 33: x_display$store_color(pixs[1] + plane, r, g, b) ! 34: end except when done: end ! 35: w: x_window, wid0, hgt0: int := x_cons("plaid", back, bdr, ! 36: xdemo_geometry(), "=401x476+1+1", ! 37: 40, 40, bwidth) ! 38: w.name := "plaid" ! 39: w.input := UnmapWindow ! 40: x_window$map(w) ! 41: w.input := ExposeWindow + UnmapWindow ! 42: ev: event := x_input$empty_event() ! 43: nobit: x_bitmap := x_bitmap$none() ! 44: while true do ! 45: x_window$clear(w) ! 46: sx, sy, width, height, bw, ms, wk: int, iw: x_window := x_window$query(w) ! 47: if width <= 30 cor height <= 30 ! 48: then x_window$destroy(w) ! 49: return ! 50: end ! 51: width := width / 2 ! 52: height := height / 2 ! 53: x: int := 0 ! 54: y: int := 0 ! 55: xinc: int := 2 ! 56: yinc: int := 2 ! 57: count: int := 0 ! 58: while count ~= 0 cor ~x_input$pending() do ! 59: if count = 10 ! 60: then count := 0 ! 61: else count := count + 1 ! 62: end ! 63: if x ~= 0 cand y ~= 0 ! 64: then x_window$pix_fill(w, 0, nobit, width - x, height - y, ! 65: 2 * x, 2 * y, GXinvert, plane) ! 66: end ! 67: x := x + xinc ! 68: if x < 0 cor x >= width - 1 ! 69: then x := x - 2 * xinc ! 70: xinc := -xinc ! 71: end ! 72: y := y + yinc ! 73: if y < 0 cor y >= height ! 74: then y := y - 2 * yinc ! 75: yinc := -yinc ! 76: end ! 77: end ! 78: x_input$deq(ev) ! 79: if ev.kind = UnmapWindow ! 80: then x_input$deq(ev) end ! 81: end ! 82: end plaiddemo
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.