I am attempting to draw a line onto a canvas, but it is being overdrawn by another canvas. I have tried to set the other canvas such that it is instantiated in code to the back, with no luck. My line code is:
The other canvas has a group2D object with a FigureShape. I tried to put the 2D object into a backdrop using: me.backdrop.objects=groupD, with no luck. However the 2D object did appear without this statement.
The idea of the project (which use to work long before strict adherence to the paint event) is to allow "laser"beams to refract, or reflect through or off of prisms and mirrors of multiple optical characteristics. Each mirror or prism is on its own canvas, which can be moved about, rotated and changes to optical characteristics, Here in this very simple example a laser beam is being refracted through the prism. The beam is being masked by the prism. It is there as when I move the prism the beam is visible.
The color of the prism embeds data about the prism (index of refraction, canvas# and prism#. The coordinates of the edges embed the normal angle.
There must be a way to draw on top of things. The laser line is on a canvas that overlays the entire blue surface. Do I needs a canvas for the laser line? (i didn’t use to.)
Especially under Windows, overlapping canvases is a recipe for flicker.
I have an app I started on Mac with overlapping canvases. Once compiled on Windows, it was unusable. I had to refactor it so all drawing is now done in a single canvas.
again… one canvas… or use picture objects for the “layers”
then in the canvas paint event, draw the pictures over each other (of course THEY need transparent backgrounds)
FYI… you can’t post a link to a file on your personal computer
I did a game using a similar description, it had mirrors, lasers etc… and the lasers were animated… all in ONE canvas
One canvas with an array of drawingObjects
Each drawingObject knows how to draw itself and reacts to events like drag
A draw mehod that calls each drawingObjects paint method so that they draw to the canvas