• Frame that contains all layers?

    From Kirkman@VERT/GUARDIAN to All on Tue Aug 18 22:18:58 2015
    A Frame.js question:

    Say I have a frame called "bgframe" and it has three child frames. The child frames are each partially transparent and stacked on top of each other, so
    that parts of each of the layers are seen in what's rendered in the terminal.

    I have in the past done this exact thing, and it works great on the BBS.

    My question today: Is there a way in javascript to iterate over the entire rendered screen (or a flattened, rendered version of bgframe and its children)?

    I can iterate over those individual child frames and getData(), but each frame is separate, so where a character is transparent, I'm not getting any data from the frame below.

    I can't use getData() on bgframe because it's just an empty holder parent frame. At least as far as I can tell.

    --Josh

    ////--------------------------------------------------
    BiC -=- http://breakintochat.com -=- bbs wiki and blog

    ---
    þ Synchronet
  • From echicken@VERT/ECBBS to Kirkman on Wed Aug 19 01:21:10 2015
    Re: Frame that contains all layers?
    By: Kirkman to All on Tue Aug 18 2015 15:18:58

    My question today: Is there a way in javascript to iterate over the entire rendered screen (or a flattened, rendered version of bgframe and its children)?

    I can iterate over those individual child frames and getData(), but each frame is separate, so where a character is transparent, I'm not getting any data from the frame below.

    I haven't looked, but based on what you're saying I would assume that each Frame just tracks its own data, and none (including the parent) has knowledge of what's in the others.

    There might already be a method for this that I don't know about. If MCMLXXIX is around, he might have some comments. For now I'll suggest:

    I think that we can probably add a method that will return a flattened version of each frame's .data array, with the topmost layers taking precedence over data from those below. Here's something that you can try:

    - Get your layers of frames set up as you've described
    - Call .screenshot(system.text_dir + "blah.bin", false) on the parent frame
    - Open text/blah.bin in an ANSI editor; column width is same as frame width was

    If blah.bin has the image that you're expecting (all of the contents of the frames tht were visible at the time), then that's a good start and we can move on from there. I'll make a Frame.dump method that will do what you're looking for.

    If not ... something else can be done.

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230
    þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com
  • From Kirkman@VERT/GUARDIAN to echicken on Fri Aug 21 21:07:15 2015
    Re: Frame that contains all layers?
    By: echicken to Kirkman on Tue Aug 18 2015 06:21 pm

    - Get your layers of frames set up as you've described
    - Call .screenshot(system.text_dir + "blah.bin", false) on the parent frame - Open text/blah.bin in an ANSI editor; column width is same as frame width was

    If blah.bin has the image that you're expecting (all of the contents of the frames tht were visible at the time), then that's a good start and we can move on from there. I'll make a Frame.dump method that will do what you're looking for.

    I finally got a minute to try this, and, yes, .screenShot() seems to capture only the child frames, which is exactly what I want.

    --Josh

    ////--------------------------------------------------
    BiC -=- http://breakintochat.com -=- bbs wiki and blog

    ---
    þ Synchronet
  • From echicken@VERT/ECBBS to Kirkman on Fri Aug 21 22:43:58 2015
    Re: Frame that contains all layers?
    By: Kirkman to echicken on Fri Aug 21 2015 14:07:15

    I finally got a minute to try this, and, yes, .screenShot() seems to capture only the child frames, which is exactly what I want.

    Okay, if you want to update frame.js and try out Frame.dump(), let me know if it does what you want:

    var dump = frame.dump();
    if(typeof dump[y][x] != "undefined")
    // There is a visible character here (see dump[y][x].ch, dump[y][x].attr) else
    // This is an empty cell showing only whatever background color applies

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230
    þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com
  • From echicken@VERT/ECBBS to Kirkman on Sat Aug 22 00:42:49 2015
    Re: Frame that contains all layers?
    By: echicken to Kirkman on Fri Aug 21 2015 17:41:01

    var dump = frame.dump();
    if(typeof dump[y][x] != "undefined")
    // There is a visible character here (see dump[y][x].ch, dump[y][x].attr) else
    // This is an empty cell showing only whatever background color applies

    On my side it looked like the 'else' line went missing after I posted, but I can see it in the quote above. Anyway, there it is.

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230
    þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com
  • From echicken@VERT/ECBBS to Kirkman on Sat Aug 22 00:43:36 2015
    Re: Frame that contains all layers?
    By: echicken to Kirkman on Fri Aug 21 2015 17:42:49

    On my side it looked like the 'else' line went missing after I posted, but I can see it in the quote above. Anyway, there it is.

    Blah herp derp, it just wasn't on its own line. :|

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230
    þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com