EmileRolley / vgr-pixmap-test

Temporary repository to store test programs for the WIP Vg bitmap renderer.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


Vgr_pixmap test repository

Temporary repository to store test programs for the WIP Vgr_pixmap renderer.
Report Bug · Contribute

Table of Contents

Results

Result images produced by the Vgr_cairo and Vgr_pixmap are stored in ./imgs/.

And could be re-rendered by executing:

dune build && ./_build/default/bin/main.exe

Rendering showcase

The left image isrendered with Vgr_cairo the right one is rendered with Vgr_pixmap.

Two straight lines

Show source code
let two_stroked_straight_lines = P.empty
  |> P.sub (v 0.2 0.3)
  |> P.line (v 0.75 0.5)
  |> P.line (v 0.2 0.85)
  |> simple_cut

1. Two closed sub-paths

Show source code
let closed_sub_paths = P.empty
  |> P.sub (v 0.2 0.) |> P.line (v 0.5 0.25) |> P.sub (v 0.5 0.5)
  |> P.line (v 0.6 0.5) |> P.line (v 0.6 0.6) |> P.close |> simple_cut

2. Imbricated and non-zero filled squares (not same direction)

Show source code
let imbricated_filled_squares_not_same_dir =  P.empty
  |> P.rect (Box2.v (v 0.25 0.25) (v 0.5 0.5))
  |> P.sub (v 0.3 0.3)
  |> P.line (v 0.3 0.7)
  |> P.line (v 0.7 0.7)
  |> P.line (v 0.7 0.3)
  |> P.close
  |> filled_with_border ~area:`Anz ~c:(Color.v 0.88 0.69 1. 1.)

3. Imbricated and non-zero filled squares (same direction)

Show source code
let imbricated_filled_squares_same_dir = P.empty
  |> P.rect (Box2.v (v 0.1 0.1) (v 0.8 0.8))
  |> P.rect (Box2.v (v 0.2 0.2) (v 0.6 0.6))
  |> P.rect (Box2.v (v 0.3 0.3) (v 0.4 0.4))
  |> filled_with_border ~area:`Anz ~c:(Color.v 0.88 0.69 1. 1.)

4. Closed cubic Bézier curve

Show source code
let closed_cbezier = P.empty
  |> P.ccurve (v 0.8 0.2) (v 0.8 0.2) (v 0.5 0.8)
  |> P.close
  |> simple_cut

5. Filled cubic Bézier curve

Show source code
let filled_cbezier = P.empty
  |> P.ccurve (v 0.8 0.2) (v 0.8 0.2) (v 0.5 0.8)
  |> P.close
  |> simple_filled_cut ~area:`Aeo ~c:(Color.v 0.48 0.71 0.38 1.)

6. Multiple filled cubic Bézier curves

Show source code
let mult_filled_cbeziers = P.empty
  |> P.ccurve (v 0.6 0.2) (v 0.6 0.2) (v 0.5 0.8)
  |> P.ccurve (v 0.8 0.2) (v 0.8 0.2) (v 0.6 0.3)
  |> P.close
  |> simple_filled_cut ~area:`Aeo ~c:(Color.v 0.48 0.71 0.38 1.)

7. Quadratic Bézier curve

Show source code
let simple_qbezier = P.empty
  |> P.qcurve (v 0.8 0.2) (v 0.6 0.8) |> P.close |> simple_cut

8. Non-zero filled star

Show source code
let nz_star = P.empty
  |> P.sub (v 0.2 0.1)
  |> P.line (v 0.5 0.9)
  |> P.line (v 0.8 0.1)
  |> P.line (v 0.1 0.65)
  |> P.line (v 0.9 0.65)
  |> P.close
  |> filled_with_border ~area:`Anz ~c:(Color.v 0.48 0.71 0.38 1.)

9. Even-odd filled star

Show source code
let eo_star = P.empty
  |> P.sub (v 0.2 0.1)
  |> P.line (v 0.5 0.9)
  |> P.line (v 0.8 0.1)
  |> P.line (v 0.1 0.65)
  |> P.line (v 0.9 0.65)
  |> P.close
  |> filled_with_border ~area:`Aeo ~c:(Color.v 0.48 0.71 0.38 1.)

10. Simple polygon with border

Show source code
let poly1 = P.empty
  |> P.sub (v 0.2 0.2)
  |> P.line (v 0.2 0.7)
  |> P.line (v 0.3 0.4)
  |> P.line (v 0.5 0.7)
  |> P.line (v 0.8 0.2)
  |> P.close
  |> filled_with_border ~area:`Aeo ~c:(Color.v 0.48 0.71 0.38 1.)

11. Scaled polygon

Show source code
let scaled_poly = I.scale (v 0.5 0.5) poly1

12. Translated polygon

Show source code
let moved_poly = I.move (v 0.5 0.5) scaled_poly

13. Rotated polygon

Show source code
let rotated_poly = I.rot 0.20 moved_poly

14. Applied transformation matrix

Show source code
let m_poly = I.tr M3.(v 0.5 0. 0.3 0. 1. 0. 0. 0. 1.) scaled_poly

Rendering time comparison Deprecated

Vg image (1181x1181) Vgr_cairo rendering time Vgr_pixmap rendering time
two_stroked_straight_lines 0.055174s 0.000070s
closed_sub_paths 0.055282s 0.000061s
imbricated_filled_squares_not_same_dir 0.058220s 0.004771s
cairo-imbricated_filled_squares_same_dir 0.075290s 0.012154s
closed_cbezier 0.058570s 0.000137s
filled_cbezier 0.054751s 0.006338s
mult_filled_cbeziers 0.054836s 0.003525s
simple_qbezier 0.056556s 0.000127s
non_zero_rule_star 0.052657s 0.004548s
even_odd_rule_star 0.053657s 0.003701s
poly 0.055466s 0.007711s
scaled_poly 0.058964s 0.002356s
moved_poly 0.058006s 0.002909s
rotated_poly' 0.058723s 0.003000s
tr_matrix_poly' 0.057560s 0.001019s

About

Temporary repository to store test programs for the WIP Vg bitmap renderer.


Languages

Language:OCaml 84.7%Language:Makefile 15.3%