Rebol 编程/load-image
外观
< Rebol 编程
LOAD-IMAGE image-file /update /clear
通过内存中的图像缓存加载图像。
LOAD-IMAGE 是一个函数值。
- image-file -- 本地文件或远程 URL(类型:文件 URL)
- /update -- 强制从源站点更新
- /clear -- 清除整个缓存
load-image: func [
"Load an image through an in-memory image cache."
image-file [file! url!] "Local file or remote URL"
/update "Force update from source site"
/clear "Purge the entire cache"
/local image image-cache
][
image-cache: []
if clear [system/words/clear image-cache recycle]
if any [update not image: select image-cache image-file] [
if all [update image] [remove/part find image-cache image-file 2]
repend image-cache [
image-file
image: either file? image-file [load image-file] [
either update [load-thru/binary/update image-file] [load-thru/binary image-file]
]
]
]
image
]