Mike James 1 Posted November 21, 2020 Once upon a time the Graphics32 library was faster than the Delphi TBitmap. Is it still the case? Are there any performance comparisons anywhere between FMX Bitmaps, VCL Bitmaps and Graphics32? Regards, -<mike>- Share this post Link to post
Anders Melander 1784 Posted November 21, 2020 1 hour ago, Mike James said: Once upon a time the Graphics32 library was faster than the Delphi TBitmap. Is it still the case? Generally Graphics32 does everything faster but specifically you will need to clarify what operations you're asking about to get a usable answer. Share this post Link to post
FPiette 383 Posted November 21, 2020 1 hour ago, Mike James said: FMX Bitmaps, VCL Bitmaps and Graphics32 You forgot Direct2D bitmaps. Recent Delphi versions has a Direct2D canvas which can be used. 1 Share this post Link to post
Arnaud Bouchez 407 Posted November 21, 2020 (edited) @FPiette Direct2D is no silver bullet either. It has been reported to be slower than GDI, due to wrongly implemented drivers, and is somewhat deprecated/unoptimized/unused. @Mike James Don't forget about GDI+ which is part of Windows, and has good performance, with nice features like Alpha channel and good antialiaising. Which kind of drawing do you need? Edited November 21, 2020 by Arnaud Bouchez Share this post Link to post
FPiette 383 Posted November 21, 2020 4 minutes ago, Arnaud Bouchez said: Direct2D is no silver bullet either. It has been reported to be slower than GDI, due to wrongly implemented drivers, and is somewhat deprecated/unoptimized/unused. @Arnaud Bouchez This report is 10 years old. Things have changed, drivers are OK now, DirectX and Direct2D have changed. 1 Share this post Link to post
Arnaud Bouchez 407 Posted November 21, 2020 (edited) 6 minutes ago, FPiette said: @Arnaud Bouchez This report is 10 years old. Things have changed, drivers are OK now, DirectX and Direct2D have changed. Do you speak about Direct 2D 1.1 or Direct 2D 1.0? 😉 At least with GDI (GDI+) or Graphics32 we have consistent performance. Edited November 21, 2020 by Arnaud Bouchez Share this post Link to post
Anders Melander 1784 Posted November 21, 2020 47 minutes ago, Arnaud Bouchez said: Don't forget about GDI+ which is part of Windows, and has good performance, with nice features like Alpha channel and good antialiaising. It's been a while since I did any comparisons of Graphics32 and GDI+ but AFAIR in the few cases where GDI+ came close to Graphics32 it did so at the cost of quality - e.g. fewer anti-aliasing levels or anti-aliasing via oversampling. To be fair the performance of Graphics32 comes at the cost of versatility since it only does 32-bit images. Graphics32 also has a steep learning curve. In those cases where GDI+ has a feature missing from Graphics32 I believe one can use GDI+ to draw on a Graphics32 bitmap via the bitmap handle. Share this post Link to post
Mike James 1 Posted November 22, 2020 15 hours ago, Arnaud Bouchez said: @FPiette Direct2D is no silver bullet either. It has been reported to be slower than GDI, due to wrongly implemented drivers, and is somewhat deprecated/unoptimized/unused. @Mike James Don't forget about GDI+ which is part of Windows, and has good performance, with nice features like Alpha channel and good antialiaising. Which kind of drawing do you need? Hi Arnaud, It's for a mapping project so it involves tiling, overlaying grids and bitmaps. Regards, -<mike>- Share this post Link to post
Arnaud Bouchez 407 Posted November 22, 2020 Did you try with FMX? Then you can switch the rendering engine behind it. Share this post Link to post
Mike James 1 Posted November 23, 2020 18 hours ago, Arnaud Bouchez said: Did you try with FMX? Then you can switch the rendering engine behind it. I was hoping to stay VCL but I'll give it a look. Thanks. Share this post Link to post
David Heffernan 2345 Posted November 23, 2020 9 minutes ago, Mike James said: I was hoping to stay VCL but I'll give it a look. Thanks. I'm sure you can get the performance you need with the vcl Share this post Link to post
Alberto Fornés 22 Posted November 23, 2020 I think OpenGL can be a good option for this. Share this post Link to post
Anders Melander 1784 Posted November 23, 2020 1 hour ago, Alberto Fornés said: I think OpenGL can be a good option for this. Why do you think that? Share this post Link to post
Alberto Fornés 22 Posted November 23, 2020 9 hours ago, Anders Melander said: Why do you think that? Years ago I was testing various possibilities to display points, lines, polygons, etc. on a map, with various libraries and OpenGL was the one who did it the fastest, perhaps showing text found worse performance. Share this post Link to post
David Heffernan 2345 Posted November 23, 2020 4 minutes ago, Alberto Fornés said: Years ago I was testing various possibilities to display points, lines, polygons, etc. on a map, with various libraries and OpenGL was the one who did it the fastest, perhaps showing text found worse performance. OpenGL doesn't seem like an obvious choice for 2D graphics on Windows. Share this post Link to post
Anders Melander 1784 Posted November 23, 2020 13 minutes ago, Alberto Fornés said: Years ago I was testing various possibilities to display points, lines, polygons, etc. on a map, with various libraries and OpenGL I think the primary strength of OpenGL is that it's portable. Coming in at a close second is the performance of 2D and 3D vector graphics helped by the fact that many operations are hardware accelerated. Of course this is only a benefit if you have a fast graphics card (otherwise it's a bottleneck), but the same can be said for Direct2D. I do not think that it can compete when it comes to raster graphics which I think is what Mike is asking for. Share this post Link to post
Vandrovnik 214 Posted November 23, 2020 47 minutes ago, Anders Melander said: I do not think that it can compete when it comes to raster graphics which I think is what Mike is asking for. In OpenGL, he can work with raster graphics really fast and easy - he just loads them as textures. But writing text and printing will not be so easy, if they are needed. 1 Share this post Link to post
David Heffernan 2345 Posted November 24, 2020 8 hours ago, Vandrovnik said: In OpenGL, he can work with raster graphics really fast and easy - he just loads them as textures. But writing text and printing will not be so easy, if they are needed. This seems like choosing a library, and then trying to work out how to fit that library to the problem. That's the wrong way round. One should first understand the problem space, its requirements and constraints, and then find the best solution. Problem first, then solution. Not the other way round. Share this post Link to post
Vandrovnik 214 Posted November 24, 2020 24 minutes ago, David Heffernan said: This seems like choosing a library, and then trying to work out how to fit that library to the problem. That's the wrong way round. One should first understand the problem space, its requirements and constraints, and then find the best solution. Problem first, then solution. Not the other way round. I did not suggest OpenGL, I just wrote that it works fine for raster graphics ("It's for a mapping project so it involves tiling, overlaying grids and bitmaps."). Share this post Link to post