| Author |
Topic  |
|
|
HMArnold
 
USA
35 Posts |
Posted - Jul 18 2026 : 15:32:55
|
What is the best way to be able to draw thousands of X marks using standard Bitmap MoveTo/LineTo commands?
I have been using multiple layers with
Image.AddNewObject(iekLine,Rect(X-Length,Y-Length,X+Length,Y+Length),Color));
The problem is that with several thousand marks, I can clear the marks without reloading the image, but it takes too long to redraw all the new layers.
I have also tried doing the marks directly on the image, which works much faster for adding new marks, but every time I want to redraw the screen for any reason, such as deleting one mark and re-drawing the rest, I have to also reload the image, which is huge and also takes time.
Is there a way to define a single layer to hold all the marks in such a way that to clear the screen I just delete that one layer and don't have to reload the full image?
I want the marks to show up on the image.
Thanks in advance
HM Arnold |
|
|
xequte
    
39489 Posts |
Posted - Jul 20 2026 : 02:06:00
|
Hi
Firstly, please note that your code is not using Layers but (legacy) TImageEnVect objects.
https://www.imageen.com/help/TImageEnVect_vs_TIELayers.html
I think thousands of line objects (or layers) will give you performance issues, so I think using a bitmap is a better option. You could cache some bitmaps to provide some performance tweaks (e.g. storing the previous bitmap, if they want to delete the last point).
Other possible options (requires using layers):
- Custom drawing of the layer containing all points. See demo: LayerEditing\Layers_CustomDraw\LayersDraw.dpr
- Using a TIEPolyline layer and adding your lines separated by break points
e.g. AddPoint( 500, 500 ); AddPoint( 600, 500 ); AddPoint($FFFFF, $FFFFF); // Break AddPoint( 580, 500 ); AddPoint( 400, 580 ); AddPoint($FFFFF, $FFFFF); // Break AddPoint( 20, 35); AddPoint( 120, 135); AddPoint($FFFFF, $FFFFF); // Break
http://www.imageen.com/help/TIEPolylineLayer.AddPoint.html
Nigel Xequte Software www.imageen.com
|
 |
|
|
HMArnold
 
USA
35 Posts |
Posted - Jul 23 2026 : 06:45:12
|
Thanks for the response.
Cacheing the image then dropping it back in view sounds promising.
I find example of how to control cache options, but not an example of how to use it.
Is there a demo that shows how to cache and image, then bring it back?
Thanks
HM Arnold |
 |
|
|
xequte
    
39489 Posts |
Posted - Jul 28 2026 : 23:27:39
|
Sorry, I mean that you should store a bitmap (or an array of bitmaps) in your unit of the previous state(s) so you can quickly revert back to them.
Nigel Xequte Software www.imageen.com
|
 |
|
| |
Topic  |
|
|
|