Removing Canvas

Help creating logic scripts for Air Manager Instruments

Moderators: russ, Ralph

Post Reply
Message
Author
User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Removing Canvas

#1 Post by Keith Baxter »

@Corjan

In managing resources, the "remove()" function does not work with canvas.
I want to remove all memory from a canvas so as to allow for resource management.
Is this code working the same as remove(myimage) but for canvas, or am I missing something.

Code: Select all

circle_id = canvas_add(0, 0, 200, 200)
canvas_draw(circle_id, function()
  _circle(100, 100, 100)
  _fill("red")
end)
canvas_draw(circle_id, function()
 circle_id=nil
end)
circle_id = canvas_add(0, 0, 200, 200)
canvas_draw(circle_id, function()
  _circle(100, 100, 100)
  _fill("blue")
end)
So as soon as I make the "circle_id=nil" I cannot use the node "circle_id" anymore and have to re add the canvas if I want to reinstate.

Keith
Last edited by Keith Baxter on Thu Nov 12, 2020 10:55 am, edited 1 time in total.
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Ralph
Posts: 7933
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Removing Canvas

#2 Post by Ralph »

Just add a boolean that decides of the canvas draws or not... ?

User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Removing Canvas

#3 Post by Keith Baxter »

Ralph wrote: Thu Sep 17, 2020 2:06 pm Just add a boolean that decides of the canvas draws or not... ?
Ralph,

Yes , But once drawn I want to know if it is still held in memory if it is redrawn like what happens with myimage()

I want to make sure that resources are cleared by removing the canvas then do a redraw.

I really need the process explained a little bit more in detail please.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Removing Canvas

#4 Post by Keith Baxter »

Hi,

I think to explain better.

If I draw a canvas with a bunch of data. Then redraw the same canvas with another bunch of data, then redraw the same canvas with another bunch of data.

Is all the previous data still held in memory if not cleared? or, does the redraw automatically clear the previous data in memory.

I am asking this because Corjan added the remove(myimage) to remove images that were replaced by others as the old images were NOT cleared by replacing the image causing AM to give issues..

Hope you's are understanding this old "PITA" guy. :)

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

Post Reply