Skia4Delphi is an open-source, cross-platform 2D graphics library for Delphi, utilizing the esteemed Google's Skia library.
Skia is an exceptional open-source library dedicated to rendering 2D text, geometries and images, with a focus on precision, superior quality and high performance. It offers versatile APIs compatible with a wide range of hardware and software platforms.
Google's Skia Graphics Library functions as the graphics engine for numerous products, including Google Chrome, Chrome OS, Android, Flutter, Xamarin, Mozilla Firefox, Firefox OS, and more.
Using the Skia4Delphi library it is possible to override Firemonkey's graphic engine so that it can use Skia as its default Canvas. With that, your Firemonkey application will automatically:
Learn more...
You can install Skia4Delphi in 3 ways:
Setup (recommended)
Download the setup of latest release and install it.
Learn more...
With Skia4Delphi it is possible to create PDF documents and draw anything on them, from text to images. The example below demonstrates how to create an PDF document and draw an SVG inside it:
var LSVGDOM := TSkSVGDOM.MakeFromFile('SamplesDemoAssetslion.svg');
var LSize := TSizeF.Create(600, 600);
LSVGDOM.SetContainerSize(LSize);
var LDocumentStream := TFileStream.Create('output.pdf', fmCreate);
try
var LDocument := TSkDocument.MakePDF(LDocumentStream);
try
var LCanvas := LDocument.BeginPage(LSize.Width, LSize.Height);
try
// Draw anything here with Skia canvas
LSVGDOM.Render(LCanvas);
finally
LDocument.EndPage;
end;
finally
LDocument.Close;
end;
finally
LDocumentStream.Free;
end;This code results in the output below:
The Skia4Delphi library supports many image formats. See below the list:
Supported formats for decoding
| Image Format | Extensions |
|---|---|
| Bitmap | .bmp |
| GIF | .gif |
| Icon | .ico |
| JPEG | .jpg, .jpeg |
| PNG | .png |
| Raw Adobe DNG Digital Negative | .dng |
| Raw Canon | .cr2 |
| Raw Fujifilm RAF | .raf |
| Raw Nikon | .nef, .nrw |
| Raw Olympus ORF | .orf |
| Raw Panasonic | .rw2 |
| Raw Pentax PEF | .pef |
| Raw Samsung SRW | .srw |
| Raw Sony | .arw |
| WBMP | .wbmp |
| WebP | .webp |
Note: Raw images are limited to non-windows platforms
Supported formats for encoding
| Image Format | Extensions |
|---|---|
| JPEG | .jpg, .jpeg |
| PNG | .png |
| WebP | .webp |
WebP is a modern image format that provides superior lossless and lossy compression for images. WebP lossless images are 26% smaller in size compared to PNGs. WebP lossy images are 25-34% smaller than comparable JPEG images at equivalent quality.
The example below demonstrates how to encoder to WebP format:
var LImage := TSkImage.MakeFromEncodedFile('SamplesDemoAssetskung-fu-panda.png');
LImage.EncodeToFile('output.webp', TSkEncodedImageFormat.WEBP, 80);
LImage.EncodeToFile('output.jpg', TSkEncodedImageFormat.JPEG, 80);This code results in the output below:
Learn more...
| RAD Studio | Platforms |
|---|---|
| RAD Studio 11 Alexandria or newer | All Platforms |
| RAD Studio 10.3 Rio or newer | Windows, Android |
| RAD Studio XE7 or newer | Windows |
For the platforms supported by Skia4Delphi (listed above), the OS versions supported by the library are the same OS versions that RAD Studio supports.
The APIs are very similar to Skia's, few methods and functions have been renamed for readability, so the Skia documentation can be used.
Skia4Delphi 6.2.0
Skia Version used: chrome/m107
Help us responding a small questionnaire about our users in this link