Jump to content

Rebol Programming/load-stock

From Wikibooks, open books for an open world

USAGE:

[edit | edit source]
LOAD-STOCK name /block size 

DESCRIPTION:

[edit | edit source]

Load and return stock image. (Keep cache after first load)

LOAD-STOCK is a function value.

ARGUMENTS:

[edit | edit source]
  • name -- (Type: any)

REFINEMENTS:

[edit | edit source]
  • /block
    • size -- (Type: any)

SOURCE CODE

[edit | edit source]
load-stock: func [
    {Load and return stock image. (Keep cache after first load)} 
    name 
    /block size 
    /local image
][
    if not image: find system/view/vid/image-stock name [
        make error! reform ["Image not in stock:" name]
    ] 
    either block [
        block: copy [] 
        loop size [
            if not image? second image [change next image load second image] 
            append block second image 
            image: skip image 3
        ] 
        return block
    ] [
        if not image? second image [change next image load second image] 
        return second image
    ]
]