locked
Type of directX surface for interactive vector drawing application

    General discussion

  • Hi,

    I am working on an interactive vector drawing application using directx. I am considering using VirtualSurfaceImageSource for rendering since it might need to load large images.
    Basically, the objective is to draw interactive graphics using brush or pen tools on top of large images. So, is the latency provided by VirtualSurfaceImageSource alright to handle such interactive operations or should I consider using DirectX swap chain background panel for this purpose??

    Thanks in advance.


    Thursday, April 11, 2013 7:53 AM

All replies

  • Hi,

    I think both are ok, I think the problem you may meet is how to inter action with the Direct layer. Swap chain can catch the mouse events, but the VirtualSurfaceImageSource needs your to pass the event.

    Best regards,
    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, April 12, 2013 6:44 AM
    Moderator
  • Thank Jesse,

    1. Is it fine to have more than one instance of VirtualSurfaceImageSource? i.e. to have it per document?

    2. How to attach it to windows event handler? Can we keep a Canvas or some other UI element underneath the surface to catch the events for us?

    3. If we use Swap chain, then how will it handle the large images? Will it still render the large image tile by tile for the visible area only?
    • Edited by John Rick Friday, April 12, 2013 3:00 PM
    Friday, April 12, 2013 2:59 PM
    1. It's fine to have multiple instances of VirtualSurfaceImageSource
    2. A VirtualSurfaceImageSource must be attached to another control - e.g. set as the source of an Image control, or the source of an ImageBrush which is then used to paint some other control like a Grid or Rectangle.  You must therefore handle input events on the control that the VSIS is painting
    3. SwapChainBackgroundPanel does not do automatic tiling of images for you - you would have to build the logic for this yourself in your DirectX code, which is possible but probably more work than using VSIS

    VirtualSurfaceImageSource will have noticeably more latency than a SwapChainBackgroundPanel when doing interactive drawing.


    Friday, April 12, 2013 7:58 PM
  • Thanks a lot Jesse,

    Sorry to bother you again and agin :) I am considering the design for our app and I want to make a good initial choice.

    Just one more thing:

    1. How can I implement the tiling logic for SwapChainBackgroundPanel? Any pointers about the code/apis will be very useful to get an idea and the effort involved.

    2. As far as I understand, VSIS provides the support for tile by tile rendering only. But, what if I want the similar thing to load the image from disk? Is there an API or Microsoft class to read the image tile by tile from the disk so as to save the disk latency too?

    Thanks again in advance.

    Saturday, April 13, 2013 4:01 PM
  • Someone please respond.
    Tuesday, April 16, 2013 12:16 PM
  • There's no automatic way to get tiles out of a single image on disk.  If the images are in a compressed encoded format, it's quite possible the structure of the image files would be nonlinear and wouldn't support that even if you write the code to do so.  The cost to load from disk is the same between VSIS and SwapChainBackgroundPanel.  If the image content is known ahead of time, perhaps you could split it into multiple files on disk?

    Custom tiling would probably involve keeping track of where the user has scrolled and just drawing separate images at the appropriate location on screen which map to the current scroll position. 

    Wednesday, April 17, 2013 12:06 AM
  • Thanks Jesse, It was very helpful.
    Wednesday, April 17, 2013 6:31 AM