Jump to content

Draw objects on canvas and manipulate with them

Recommended Posts

Maybe a stupid question but not for me at the moment.

Need a way to draw rectangles on a canvas and then to make it possible to resize, move, delete or clone. That is needed to automate some process of segmentation objects (same kind of objects by rectangles with same aspect ratio) on a bunch of images (>100K).

For now I can draw rectagles on a TImage canvas wthout any questions. But can't figure out how to select that rectangle with mouse, resize it, scale it and move.

Or maybe should I look at shapes?

Share this post

Link to post

Yóu can draw like this.

But the Canvas is a raster-based area, which doesn't contain graphical objects.

So the only way would be to re-paint the objects, as you like.

Usually this is done via FrameBuffer bitmaps, where you can do the clearing and drawing, and then
paint the whole frame buffer to the canvas each frame (or when changed).

Edited by Rollo62
  • Like 1

Share this post

Link to post

I would not draw directly on the canvas. Use TShapes.

You may also want to have a look at this selection component that is part of FMX:



  • Like 1

Share this post

Link to post

use TPath  and  change before drawing again or  use  TObjectList  and  always  draw the full objectlist , individual items are  rects .....


Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now