summaryrefslogtreecommitdiffstatsci
path: root/samples/tests/compositing.cpp
blob: d122912e17426b27b95a45db3db133114a50af3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "VkvgTest.hpp"
TEST(compositing) {
    VkvgContext ctx = vkvg_create(test->surf);
    vkvg_clear(ctx);

    vkvg_set_source_rgba(ctx, 1, 0, 0, 0.5f);
    vkvg_rectangle(ctx, 100, 100, 200, 200);
    vkvg_fill(ctx);

    vkvg_set_source_rgba(ctx, 0, 0, 1, 0.5f);
    vkvg_rectangle(ctx, 200, 200, 200, 200);
    vkvg_fill(ctx);

    vkvg_destroy(ctx);
}
TEST(opacity) {
    VkvgContext ctx = vkvg_create(test->surf);
    vkvg_clear(ctx);

    vkvg_set_source_rgba(ctx, 1, 0, 0, 1.0f);
    vkvg_rectangle(ctx, 100, 100, 200, 200);
    vkvg_fill(ctx);

    vkvg_set_opacity(ctx, 0.5f);

    vkvg_set_source_rgba(ctx, 0, 0, 1, 1.0f);
    vkvg_rectangle(ctx, 200, 200, 200, 200);
    vkvg_fill(ctx);

    vkvg_destroy(ctx);
}