Thursday, April 21, 2011

Rebol Draw: how to load image from the internet ?

This works

view layout [
    image load http://i2.ytimg.com/vi/e3wShd_bX8A/default.jpg
]

But this doesn't

view layout [box 100x100 effect [draw [
        image load http://i2.ytimg.com/vi/e3wShd_bX8A/default.jpg
    ]
]
From stackoverflow
  • LOAD is not part of the EFFECT or DRAW dialects, so it is being ignored.

    You can use COMPOSE to ensure it gets executed:

    view layout [
        box 100x100 effect compose/deep [
            draw  [
            image (load http://i2.ytimg.com/vi/e3wShd_bX8A/default.jpg)
            ]
        ]
    

    ]

    Notes:

    • COMPOSE/DEEP because we are two deep in blocks -- effect [draw [ ... ]]

    • the "native" REBOL code that you want executed is in parenthesis: (load ...)

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.