overlapping images lazarus / 39-Graphics ---------------------------------------------------------------------- xinyiman · 2016-08-04 12:19 Hello guys, who tells me how to get two overlapping images and the one that remains the front can move? Let me give an example, we shall have to draw a line on a TImage and this line must be able to move after it is drawn. How can I do? Are there examples? Thank you ---------------------------------------------------------------------- Handoko · 2016-08-04 12:43 It depends on what graphics engine you want to use. If you just want to use the default Lazarus components, you can make use the onDraw (or sometimes it called as onPaint) event. Store all the objects' data in a list (array of object or TFPObjectList or your own create class). And paint them using the z-order you like on the onDraw event. You can move and animate each one or all of them any way you like. Default Lazarus components aren't optimized for animation nor graphics performance. Usually, you will notice the performance issue if the total objects reaches about 10 or more. I suggest you to learn OpenGL. It's maybe the hardest but probably the fastest. I tested animation with hundreds of random moving object, it still run smoothly. ---------------------------------------------------------------------- xinyiman · 2016-08-04 12:54 Ok, we assume that you have an X-ray in a TImage, the line to be drawn on the radiograph the drawings in another TImage (with transparent background) and the other image positions? ---------------------------------------------------------------------- Handoko · 2016-08-04 12:59 Sorry, my English is limited. Please explain more clearly. Do you know Z-order? https://en.wikipedia.org/wiki/Z-order Make use Z-order properly, there should be no problem, the transparent things will overlap correctly.