Hello to all,

try my simple image viewer with slideshow (about 2Kb)

Have fun,

Cyphre

REBOL [
 title: "Simple Image Viewer by Cyphre"
 file: %img-viewer.r
 author: [EMAIL PROTECTED]
 rights: "Cyphre"
]

dir: []
img-size: 640x400
view layout [
 backdrop black
 across
 vtext "images path:"
 f: field "enter path for images or file" [
 if not tg/state [
  error? try [
   i/image: load to-file i/text: first dir: find sort read change-dir either
not dir? to-file f/text [clean-path to-file join f/text %/..][to-file
f/text] either dir? to-file f/text [first read to-file f/text][to-file last
parse to-file f/text "/"] show i
  ]
 ]
 ]
 button "browse" [if not any [tg/state] [if not (f/text: to-string
request-file) = "none" [show f f/action 0 0]]]
pad 180
button "exit" [if not any [tg/state] [unview/all exit]]
 return
 below
 i: image black effect [aspect] img-size with [font/align: 'left
font/valign: 'bottom]
 across
 button "|<" [if not any [tg/state empty? dir] [i/image: load to-file
i/text: first dir: head dir show i]]
 button "prev" [if not any [tg/state empty? dir] [i/image: load to-file
i/text: first dir: back dir show i]]
 button "next" [if  not any [tg/state tail? next dir] [i/image: load to-file
i/text: first dir: next dir show i]]
 button ">|" [if not any [tg/state empty? dir] [i/image: load to-file
i/text: dir: back tail dir show i]]
 tg: toggle "slideshow" "stop" [
  if tg/state [
   show tg
   dir: next dir
   dl: to-integer copy tf/text
   i/image: to-image layout compose [origin 0x0 image (either i/image
[i/image][black]) effect [aspect](img-size)]
   forall dir [
    if not tg/state [i/effect: [aspect] dir: back dir exit]
    if fx/data [
     for x 1 -255 -32 [
      i/effect: compose [luma (x)]
      show i
     ]
    ]
    i/image: to-image layout [origin 0x0 image load to-file i/text: first
dir effect [aspect] img-size]
    show i
    if fx/data [
     for x -255 1 32 [
      i/effect: compose [luma (x)]
      show i
     ]
    ]
    t: 0
    dispatch [1 [t: t + 1 if any [t = dl not tg/state] [i/effect: [aspect]
exit]]]
   ]
   dir: back dir
   tg/state: false
   show tg
  ]
 ]
 vtext "delay:"
 tf: field "3" 30x24
 vtext "fade FX"
 fx: check
]


-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to