Menu

#322 SVG capture fuctionality

v1.2
closed-accepted
nobody
SVG Capture (1)
5
2016-04-26
2014-02-20
No

This patch makes possible to trap the ROM BASIC entries used to draw graphics and print text to keep an high resolution copy of what is being drawn on the ZX Spectrum drawable screen portion.
In the "file" dialog box the root name for the file sequence must be entered.
I.E. entering "capture" it will create capture0.svg, capture1.svg, etc. On every CLS command a new file is created.
Two capture modes are available for graphics, a very BASIC low level trap to catch every dot being plotted and an advanced one converting every segment in a smooth anti-aliased way.

1 Attachments

Related

Wiki: Fuse 1.2 Release Plan

Discussion

  • Stefano Bodrato

    Stefano Bodrato - 2014-02-21

    SVG capture core updated: new features: text capture in all the modes, including graphics blocks and UDGs, attribute handling including FLASH, scrollup, and smoother dot drawing.

    missing:
    a little buggy attributes handling when 'scroll' happens

     
  • Stefano Bodrato

    Stefano Bodrato - 2014-02-21

    Preview

     
  • Stefano Bodrato

    Stefano Bodrato - 2014-02-22

    Improved: better attributes handling and support for TS2068/TC2068

     
  • Sergio Baldoví

    Sergio Baldoví - 2014-02-24

    Hi Stefano,

    looks interesting. From a code perspective, I have some suggestions:

    • Please, stick to the coding style guidelines. See hacking/coding_style.txt

    • ui.c: You should use the full description of the menu entry instead of the callback function. I'm getting this error on GTK+ UI:

      couldn't get menu item '/File/Scalable Vector Graphics/Start capture dots' from menu_factory

    • menu.c: It is better to disable menu entries after requesting for the file name, the state after clicking Cancel button is wrong.

    • gtkui.c, win32ui.c, widget.c: The initial state of "Stop capture" is wrong. It should be explicitly disabled.

    • ui/win32/menu_data.[c|h|rc]: There is not need to patch these files because are auto-generated from menu_data.dat

     
  • Stefano Bodrato

    Stefano Bodrato - 2014-02-24

    Thank you very much for your hits, I couldn't spot all the relevant sources for the UI without your help :)
    I did my best to clean up the code, but I still did not fully figure out the way the menus are being disabled after they're selected.

    Anyway I think all the points above are now met.
    This new patch overrides all the code I've posted so far, also svg.c is now updated to work with all the supported Spectrum models and clones.

     
  • Sergio Baldoví

    Sergio Baldoví - 2014-02-24

    I meant menu_data.dat has these menu entries:

    File/Scalable Vector Graphics/Start capture in _line mode..., Item
    File/Scalable Vector Graphics/Start capture in _dot mode..., Item
    

    which define the menu at the top of the window.

    And ui_menu_activate() use the menu_item_lookup structure at ui.c to interact with the menu. Both descriptions (paths) must match to allow enabling/disabling of items.

    I've attached a fixed patch:

    { UI_MENU_ITEM_FILE_SVG_CAPTURE,
      "/File/Scalable Vector Graphics/Stop capture",
      "/File/Scalable Vector Graphics/Start capture in dot mode...", 1,
      "/File/Scalable Vector Graphics/Start capture in line mode...", 1
    },
    
     
  • Fredrick Meunier

    One more comment - the code in svg_capture assumes that the default ROM file for the machine is loaded to capture the appropriate ROM calls - it should check whether the default ROM is in use (e.g. see how trap_check_rom() checks memory_custom_rom() )

     
  • Stefano Bodrato

    Stefano Bodrato - 2014-02-26

    Thank you for your support, I'll look at trap_check_rom() :)

     
  • Stefano Bodrato

    Stefano Bodrato - 2014-03-26

    Using trap_check_rom() seems a good idea.
    Obviously I have to make it global, and I'd suggest to move it.
    Where ? What aboutthe memory support functions (memory.h) ?

     
  • Stefano Bodrato

    Stefano Bodrato - 2014-03-27

    Well, this is my extra patch proposal (to be added to the Sergio's adjustment above).
    It makes the trap_check_rom alightly more generic and cleans up my trap code a lot.

     
  • Sergio Baldoví

    Sergio Baldoví - 2014-04-28

    I've attached a new patch with slight modifications on top of last Stefano patch:
    Fix syntax style
    Add include guard in svg.h
    Arranged includes in svg.c
    Use trap_type' instead ofint' in trap_check_rom()

     
  • Stefano Bodrato

    Stefano Bodrato - 2015-06-07

    Instructions:

    File, Scalable Vector Graphics, Start capture in line mode...
    Start trapping the video output functions present in ROM to copy the picture to SVG files, thus creating vectorized scalable picture; it is expected to be fully operational in BASIC only, but few machine code programs could work, if they use the ROM addresses to output text or graphics. The initial picture size is 256x176, but it is increased everytime a "scroll" happens. On every CLS a new file will be created, with an increasing sequence number. CIRCLEs will be described as a sequence of lines, so the original "imprecisions" will be still visible. The text output will be fully understood and decoded: normal ASCII characters will be converted into COURIER scalable fonts, UDG graphics into dot matrix areas, GRAPHICS blocky characters into small squares. A slightly transparent output permits to show a bit of the overlapped text and graphics elements. Lower portion of the screen (normally bound to stream #0 and #1) won't be captured.

    File, Scalable Vector Graphics, Start capture in dot mode...
    As above, but line capture is disabled. A line will be rendered as a sequence of dots.

    File, Scalable Vector Graphics, Stop capture...
    Stop the SVG capture function.

     
  • Sergio Baldoví

    Sergio Baldoví - 2015-08-23

    Thanks, committed in [r5314].

     

    Related

    Commit: [r5314]

  • Sergio Baldoví

    Sergio Baldoví - 2015-08-23
    • status: open --> pending-accepted
     
  • Sergio Baldoví

    Sergio Baldoví - 2016-04-26
    • status: pending-accepted --> closed-accepted
     

Log in to post a comment.