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

dynamically adding images

 [1/14] from: gchiu::compkarori::co::nz at: 22-Oct-2001 11:07


Anyone got a short example on how to add/remove images dynamically to a face? -- Graham Chiu

 [2/14] from: carl:cybercraft at: 22-Oct-2001 13:32


Hi Graham, On 22-Oct-01, Graham Chiu wrote:
> Anyone got a short example on how to add/remove images > dynamically to a face?
Each image requires its own face, doesn't it? Anyway, does this do what you want? ... picture: load %pic.jpg view layout [ pic: image picture button "change" [ pic/image: if pic/image = none [picture] show pic ] ] -- Carl Read

 [3/14] from: gchiu:compkarori at: 22-Oct-2001 19:34


> > Anyone got a short example on how to add/remove images > > dynamically to a face? > > Each image requires its own face, doesn't it?
Don't think so. Perhaps I should clarify - I need to add from 1 to 400 of the same image onto a face. I don't want to put 400 on to the face and move them as required. I want to add/remove them to/from the layout. -- Graham Chiu

 [4/14] from: brett:codeconscious at: 22-Oct-2001 17:35


Hi Graham,
> > > Anyone got a short example on how to add/remove images > > > dynamically to a face?
<<quoted lines omitted: 5>>
> the face and move them as required. I want to add/remove > them to/from the layout.
I'm a bit rusty not having used Rebol for a while (been travelling), but I think Carl is correct, each image is displayed by a face. If you need 1 to 400 images incrementally added/removed to/from a layout (the main face) then you will need 1 to 400 faces created/destroyed or shown/hidden at the appropriate time. So assuming you have a simple layout, create the new face and add it to the PANE block of the layout face. Try the following lines in the console. Note that the "print length?" is there to avoid returning a block of faces to the console which would cause a very long wait (lockup?). Also I used a second layout call to create the new-face so in actual fact I created two faces one of which is discarded (the face returned from the second layout). You could just as easily create the new face directly without using layout again. layout-face: layout [box red box green] layout [new-face: box blue] view layout-face print length? append layout-face/pane new-face layout-face/size: multiply layout-face/size 2x2 new-face/offset: add layout-face/pane/2/size layout-face/pane/2/offset view layout-face As I said, I've been away for a while so I've no idea what's been on the list and what hasn't - I hope it isn't redundant. Brett Handley

 [5/14] from: greggirwin:mindspring at: 22-Oct-2001 2:06


Hi Graham, << Perhaps I should clarify - I need to add from 1 to 400 of the same image onto a face. >> I think Anton has an example on his site that might help you. It's called Image Brush. --Gregg

 [6/14] from: petr:krenzelok:trz:cz at: 22-Oct-2001 10:10


Brett Handley wrote:
> Hi Graham, > > > > Anyone got a short example on how to add/remove images
<<quoted lines omitted: 13>>
> you will need 1 to 400 faces created/destroyed or shown/hidden at the > appropriate time.
This is not imo true and Cyphre will show us another aproach with his upcoming game :-) If I understand him correctly, he uses 1 main face, and every other image is being drawn using draw effect dialect. Then you need only one show to your top face ... Of course the question is which aproach is more efficient ... Cheers, -pekr-

 [7/14] from: brett:codeconscious at: 22-Oct-2001 18:47


> This is not imo true and Cyphre will show us another aproach with his
upcoming
> game :-) If I understand him correctly, he uses 1 main face, and every
other
> image is being drawn using draw effect dialect. Then you need only one
show to
> your top face ... Of course the question is which aproach is more
efficient ...
I stand, gratefully, corrected. I have more to learn with the draw effect. Thanks Pekr.

 [8/14] from: gchiu:compkarori at: 22-Oct-2001 23:14


> I think Anton has an example on his site that might help > you. It's called > Image Brush. >
Hi Gregg, Anton's website is permanently down. He's trying to find another host. -- Graham Chiu

 [9/14] from: carl:cybercraft at: 22-Oct-2001 22:48


On 22-Oct-01, Petr Krenzelok wrote:
> Brett Handley wrote: >> Hi Graham,
<<quoted lines omitted: 23>>
> dialect. Then you need only one show to your top face ... Of course > the question is which aproach is more efficient ...
Graham's trying to move from the draw dialect to bitmap images. Are you saying the draw dialect can be used to display bitmaps? (One can but hope.:)
> Cheers, > -pekr- >> Brett Handley
-- Carl Read

 [10/14] from: petr:krenzelok:trz:cz at: 22-Oct-2001 12:03


Carl Read wrote:
> On 22-Oct-01, Petr Krenzelok wrote: > > Brett Handley wrote:
<<quoted lines omitted: 27>>
> you saying the draw dialect can be used to display bitmaps? (One can > but hope.:)
of course it can ;-) You can find example in Easy Draw doc in Rebol desktop/rebol.com/docs section ... -pekr-

 [11/14] from: carl:cybercraft at: 22-Oct-2001 23:48


On 22-Oct-01, Petr Krenzelok wrote:
>> Graham's trying to move from the draw dialect to bitmap images. >> Are you saying the draw dialect can be used to display bitmaps? >> (One can but hope.:) > of course it can ;-) You can find example in Easy Draw doc in Rebol > desktop/rebol.com/docs section ...
Chuckle - you're right. How come I'd never noticed that before? (: -- Carl Read

 [12/14] from: greggirwin:mindspring at: 22-Oct-2001 10:09


Hi Graham, If it's OK with Anton, I can send you his example(s). Anton? --Gregg

 [13/14] from: gchiu:compkarori at: 23-Oct-2001 8:13


> If it's OK with Anton, I can send you his example(s). > Anton? >
Hi Gregg, Since I've discovered that the draw dialect takes bitmaps I think I can now manage :) Oh, and I have Anton's stuff cached in my rebsite cache. -- Graham Chiu

 [14/14] from: arolls:idatam:au at: 23-Oct-2001 12:16


Of course. :) -Anton.

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted