Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: One-Liners back in town!

From: ronaldoff:free at: 23-Nov-2002 0:38

Hello Carl, Saturday, November 23, 2002, 12:48:34 AM, you wrote: CR> Hi Gerard, CR> On 23-Nov-02, Gerard Cote wrote:
>> Hi Ashley and Louis, >> since I am realy a REBOL newbie, I tried to adapt your submission to >> use only REBOL for display too. And this worked as the following : >> save/png %hello.png to-image layout [banner "Hello World!"] view >> layout [image %hello.png] >> It is a lot more quicker than with the default Web browser !!! >> I also tried the following and this doesn't work similarly in the >> sense that I can't store the resulting .png file in addition to >> displaying it. >> view layout [image to-image layout [banner "Hello World!"]] >> Can someone optimize (correct it) any more ?
CR> view layout[image(save %hello.png img: to-image layout[banner"Hello CR> World!"]img)] CR> That, I think, does all you want - but is 81 characters. Darn! I'm CR> sure you can get it under 80 though. (;
>> Finally I tried to go with : view layout [image img: to-image layout >> [banner "Hello World!"]] but the result displayed is an empty image >> ... I don't understand why yet but I am looking further for an >> answer
CR> Placing the image-creation part in parens will make it work... CR> view layout [image (img: to-image layout [banner "Hello World!"])] CR> VID, being a dialect doesn't parse code in the same way as standard CR> REBOL. To make it do so, place the code in parens like I've done CR> above.
>> These other tries don't work either and I am always questioning >> myself about them ... I really miss something about the way VID and >> REBOL works in the basics, I think! >> view layout [img: save/png %hello.png to-image layout [banner "Hello >> World!"]]
CR> 1) There's no image style in the layout. ie... CR> view layout [image img: save/png %hello.png to-image layout [banner CR> "Hello World!"]] CR> 2) and it still doesn't work because save doesn't return the image. CR> You can see this at the Console...
>>> to-image layout [banner "Hello World!"]
CR> == make image! [158x68 #{ CR> 6E808E6E808E6E808E6E808E6E808E6E808E6E808E6E808E6E808E6E808E CR> 6E808E6E808E6E808E6E808E6E808E6E808E6E808E6E... CR> There, the image is returned, but if you ssave it...
>>> save/png %hello.png to-image layout [banner "Hello World!"]
CR> it isn't. This is why in my length 81 version I've put the img word CR> at the end of the paren, that causing it to be returned. Working at CR> the console's the way to sort out problems with your REBOL code. CR> Start with what's working and add bits, all the time watching for the CR> unexpected with what's being returned.
>> or view layout [to-image layout [banner "Hello World!"]]
CR> No image word in the layout block again.
>> or view layout [image img: save/png %hello.png to-image layout >> [banner "Hello World!"]]
CR> And the save's not returning the image again. That's very close to my CR> 81 characters version though. Just enclose in a paren and add the img CR> word. CR> Hope that explains a bit more about the workings of VID to you. How about save/png %hello.png to-image t: layout[banner "Hello World!"]view t only 67 -- Best regards, ronaldoff mailto:[ronaldoff--free--fr]