SVG quality improvements

Intro

A while back, we introduced SVG in TMS VCL UI Pack. The first version focused on smaller icon sets. We have meanwhile tweaked and improved the engine and although there is still a lot of work to be done, the next update of TMS VCL UI Pack will offer 2 quality of life improvements:

  • Gradients (GDI+)
  • Rendering quality (GDI+)
  • Disabled drawing (TVirtualImageList)

Gradients

Gradients were left out of the first version because of shortcomings on other platforms, as we also have SVG rendering engine support for FNC targeting not only VCL, but also FMX, LCL and WEB. The underlying native graphics can be quite complex and have various differences between frameworks. Therefore we decided to take the initial step of offering linear & radial gradients support in VCL only using GDI+. Please note that we are still targeting smaller less complex icons, but we’ll add improvements over time.

TMS Software Delphi  Components

Rendering quality

The initial version did not use the full quality that GDI+ had to offer. When working with SVG, we focused on adding features instead of quality and therefore the rendering quality was not optimal. We have now changed this so it has a smoother appearance independant of the size.

v1.0                       v1.1

TMS Software Delphi  Components       TMS Software Delphi  Components

Disabled drawing

In v1.0 we also added support for TVirtualImageList, which converts SVG files into bitmaps on the correct size without losing quality. You can add a TAdvSVGImageCollection attached to a TVirtualImageList and specify only one SVG suitable for any size you want. The TVirtualImageList also has the ability of automatically adding disabled state versions of the converted bitmaps. Initially, this was not working due to the way the bitmap alpha channel was configured and the SVG quality drawing on the bitmap before returning it to the TVirtualImageList. In this update, we have added correct alpha channel to the bitmap conversion routine.

TMS Software Delphi  Components TMS Software Delphi  Components

What’s next?

The above applies to VCL only and will be part of the next update of TMS VCL UI Pack. The engine is a port from FNC, support for other operating systems (macOS, iOS, Android) is still ongoing. As soon as things get shape, we’ll post an update.