Platforms and requirements
Where Fresnel runs
| Platform | Windows and input | Drawing | Free Pascal version |
|---|---|---|---|
| Linux | GTK3 | GTK3 | 3.2.2 or newer |
| Windows | Win32 | Skia | 3.3.1 |
| macOS | Cocoa | Skia | 3.3.1 |
| Android (newest) | Android | Skia | 3.3.1 |
| Browser | WebAssembly | HTML canvas | 3.3.1 |
| Inside an LCL program | LCL | LCL | 3.2.2 or newer |
Free Pascal 3.2.2 is the current release of the compiler. 3.3.1 is the development version.
The Fresnel package chooses the right backend for the platform you compile for.
You can change the choice with the FresnelBackend and FresnelRenderer build macros of the Fresnel package,
for example to use Skia on Linux too.
About Skia
Skia is a fast 2D drawing library made by Google. It is used by Chrome, Android and Flutter, among others. Fresnel uses it on Windows, macOS and Android.
You do not have to find or build Skia yourself: a ready-to-use version is included in the bin folder of the Fresnel sources.
- Windows: the program needs
sk4d.dllnext to it. - macOS: Skia is linked into the program. There is no extra file.
- Linux: Skia is not used by default. If you choose to use it, add
fresnel/bin/Binary/Shared/Linux64to the library path.
What you need
- The Free Pascal compiler. Version 3.2.2 is enough for Linux (and for the LCL backend). For Windows, macOS, Android and the browser you need the development version 3.3.1.
- The Lazarus IDE (recommended, not required). To design Fresnel forms visually, you need a recent development version of Lazarus (4.99).
- The Fresnel sources, from GitLab.
The easiest way to get the development versions of Free Pascal and Lazarus is a tool such as fpcupdeluxe. It installs them in a separate folder, so they do not interfere with the versions you already have.
Then continue with Get started.
In the browser
A Fresnel program can be compiled to WebAssembly, a format for programs that all modern browsers can run. Your forms and your code stay the same. What changes:
1. The main file. For the browser, the main file is a library instead of a program.
It uses the same form units. This is the complete browser version of the Theme demo:
library wasmTheme;
{$mode objfpc}{$H+}
uses
nothreads,
Fresnel,
Fresnel.Forms,
MainUnit; // the same form unit as the desktop version
begin
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.2. The compiler. You compile it with the WebAssembly cross-compiler of Free Pascal 3.3.1, for example:
ppcrosswasm32 -tbrowser @compile.cfg wasmTheme.lprThe result is a .wasm file.
3. A web page to load it. A small web page loads the .wasm file, starts it and gives it a place to draw.
The Fresnel repository contains such a page in demo/WebHost and demo/WebDemoHost. Its script is a small
Pascal program, compiled once with pas2js. The demos on
Try it live use exactly this page.
Some things are different in a browser, because a web page is not allowed to do everything a desktop program can do:
- A web page cannot start other programs.
- A web page cannot freely read your disk. File dialogs show a small file system that lives in the browser. Fresnel’s own file dialogs are used for this, since the browser has no file dialogs that a program can use this way.
Inside an LCL program
Fresnel can also use the LCL as its backend. Then Fresnel forms, or Fresnel controls on an LCL form, run on every platform that the LCL supports. This is the backend used by the Lazarus form designer. See Fresnel and the LCL.