Results 1 to 10 of 13

Thread: Virtual canvas and Canvas_Scale() question

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Virtual canvas and Canvas_Scale() question

    Once I put a canvas into virtual mode with Canvas_SetVirtual(), it appears that Canvas_Scale() has no effect - everything is always plotted 1:1 in the virtual canvas, no matter what I set the scale to.

    Is that by design? Is there any way to combine custom coordinate systems on a canvas with virtual mode?

    *Brian

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Yes, all is reset.
    Set scaling after setting virtual.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  3. #3
    I see.

    There's no easy way to take a canvas with a bunch of lines drawn on it at one set of coordinates (say (0,0), (1000,500)) and then change the scaling (say to (0,0),(10,50)), and have all of the graphics on the canvas follow the scaling change, is there?

    Here's what I'm really after, big picture. I've collected a lot of data points in a set of arrays. Let's say 100000 points. I can set up a virtual canvas that's 100000 pixels wide, and then draw my set of lines on the canvas. My viewport is only 1000 pixels wide, so the user can then scroll around the graph as much as they want, and it's lightning fast. It's really awesome.

    However, I'm trying to implement horizontal scaling. I have two buttons that allow you to zoom in and zoom out, so that you can change how many points of data are displayed per pixel in the viewport. This lets you see much more of the graph at once.

    But it's _so_ slow to completely redraw the whole canvas every time they change the horizontal scaling factor.

    What I'd rather do is draw the whole graph, once, to the virtual canvas, and then re-scale the virtual canvas to compress or expand the image visible through the viewport.

    Right now, it appears that when you set Canvas_Scale(), it applies to all graphic elements that you draw after that point, but it does not do anything to the existing canvas.

    Can you think of any way I can do my 'rapid scaling'?

    *Brian

  4. #4
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Scaling is just a way to create a new coordinates system.
    What you mean is a kind of zooming,

    I suppose it can be done capturing your canvas into a bitmap, stretching the bitmap, changing the scale and then putting the stretched bitmap back to the canvas.
    But this is just theory, I need to put together an example and see how it works.
    Do not know if I will have time this week. Maybe next week-end
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  5. #5
    Eros,

    Nah, don't worry about it. If there isn't an easy way built into TB, it's not worth spending time on concocting a complex example. It's just a way to make something that's working properly now, work faster. That's all.

    Thanks, as always for the awesome language. :-)

    *Brian

  6. #6
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    hmmm anyway worth to investigate.
    I will let your know if I will get something
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

Similar Threads

  1. Replies: 3
    Last Post: 26-06-2017, 19:35
  2. With {As|Like} vartype At- a virtual idea
    By ReneMiner in forum Suggestions/Ideas discussions
    Replies: 0
    Last Post: 30-01-2015, 19:57
  3. canvas loops and question
    By Lionheart008 in forum UI (User Interface)
    Replies: 4
    Last Post: 06-04-2011, 15:02
  4. Replies: 6
    Last Post: 16-06-2010, 06:40
  5. Microsoft Virtual PC 2007 SP1
    By ErosOlmi in forum Technology
    Replies: 3
    Last Post: 22-05-2008, 00:02

Members who have read this thread: 1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •