15

A just curious question.
I'm aware that:
Skia, Cairo: library
Direct2D: API
But without any additional components, exclusively on Windows platform, which bears the most features? I'm not talking about performance or programming simplicity.
Is there any possibility that Cairo could use D2D as the rendering backend on Windows platform?

Abrar Borno
  • 373
  • 1
  • 3
  • 10
  • 1
    If you're into 2D drawing, you can have a look at compound libraries like Moz2D or Chromium('s angle?) which can change the library beneath, like OpenGL(ES), Direct2D, Skia or others, according to system support or user preferences. – user3648895 Oct 03 '17 at 08:07

1 Answers1

26

I am using all three in my Sciter as graphics backends so you can compare them in action.

As of today (Nov 20, 2017):

Feature set:

Skia and Direct2D are on par by feature set. And both are feature wise supersets of Cairo.

From these three, only Direct2D (Direct2D v 1.1) supports printing. Skia and Cairo instead are capable of PDF generation so for real printing you will need 3rd party tools.

3D integration:

Direct2D has good integration with DirectX - they can work on the same DXGI device.

But it is far not that trivial to integrate Skia with existing 3D OpenGL code. Even Skia can work with OpenGL backend it changes state of OpenGL device and that creates problems.

Performance:

With Direct2D you can reach 60-250 FPS.

On Windows, Skia when used with OpenGL backend may surprisingly work better than Direct2D. But YMMV.

Platforms:

On Windows I'd suggest to use Direct2D or Skia.

On MacOS - definitely Skia with OpenGL backend. It is significantly better than Mac's native CoreGraphics.

On Linux/GTK: use Cairo as this is the default rendering API on GTK/Gnome3. And Cairo works there pretty well.

c-smile
  • 26,734
  • 7
  • 59
  • 86
  • 4
    And 6 month later OpenGL is banned from MacOS and yes,we could see this coming at least one year ago. Where is the Metal OpenGL backend? And whats with text and fonts? This has become the most expensive operation in normal apps. – Lothar Aug 08 '18 at 22:56
  • 1
    If not OpenGL then Vulkan over Metal or whatever. As of fonts... All three are quite good and fast with font rendering. ClearType or its equivalent is supported by all three. You can try sciter samples on all platforms if in doubt. – c-smile Aug 09 '18 at 03:46
  • 2
    Worth noting that Skia has also Vulkan backend, which Direct2D — obviously — haven't. Also, in recent news: [LibreOffice migrates from Cairo to Skia](https://www.phoronix.com/scan.php?page=news_item&px=Trying-LibreOffice-Vulkan-Skia). – Hi-Angel Dec 14 '19 at 15:56
  • When you say that Skia is better than Core Graphics, what metric are you using? You mean it is faster? My understanding is that output fidelity is unmatched with Core Graphics. – johnbakers Nov 17 '20 at 14:02
  • 2
    @johnbakers Better here means: faster (especially with OpenGL/HW backend) and more feature rich. Also CoreGraphics is pure CPU rasterizer as far as I understand. Output fidelity is on par . – c-smile Nov 18 '20 at 16:33