Пример #1
0
static void
gezira_snowflake_render (gezira_snowflake_t *flake)
{
    nile_Process_t *pipeline, *gate_, *COI;
    Matrix_t M = Matrix ();
    if (gezira_snowflake_offscreen (flake))
        return;
    M = Matrix_translate (M, WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2);
    M = Matrix_scale (M, zoom, zoom);
    M = Matrix_translate (M, -WINDOW_WIDTH / 2, -WINDOW_HEIGHT / 2);
    M = Matrix_translate (M, flake->x, flake->y);
    M = Matrix_rotate (M, flake->angle);
    M = Matrix_scale (M, flake->scale, flake->scale);
    COI = gezira_CompositeUniformColorOverImage_ARGB32 (init,
        FLAKE_ALPHA, FLAKE_RED, FLAKE_GREEN, FLAKE_BLUE,
        window.pixels, window.width, window.height, window.width);
    gate_ = nile_Identity (init, 8);
    nile_Process_gate (COI, gate_);
    pipeline = nile_Process_pipe (
        gezira_TransformBeziers (init, M.a, M.b, M.c, M.d, M.e, M.f),
        gezira_ClipBeziers (init, 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT),
        gezira_Rasterize (init),
        gate,
        COI,
        NILE_NULL);
    nile_Process_feed (pipeline, snowflake_path, snowflake_path_n);
    gate = gate_;
}
Пример #2
0
static void
gezira_snowflake_render (gezira_snowflake_t *flake,
                         gezira_Window_t *window, nile_Process_t *init)
{
    nile_Process_t *pipeline;
    Matrix_t M = Matrix ();
    if (gezira_snowflake_offscreen (flake))
        return;
    M = Matrix_translate (M, WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2);
    M = Matrix_scale (M, zoom, zoom);
    M = Matrix_translate (M, -WINDOW_WIDTH / 2, -WINDOW_HEIGHT / 2);
    M = Matrix_translate (M, flake->x, flake->y);
    M = Matrix_rotate (M, flake->angle);
    M = Matrix_scale (M, flake->scale, flake->scale);
    pipeline = nile_Process_pipe (
        gezira_TransformBeziers (init, M.a, M.b, M.c, M.d, M.e, M.f),
        gezira_ClipBeziers (init, 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT),
        gezira_Rasterize (init),
        gezira_CompositeUniformColorOverImage_ARGB32 (init,
            &window->image,
            FLAKE_ALPHA, FLAKE_RED, FLAKE_GREEN, FLAKE_BLUE),
        NILE_NULL);
    nile_Process_feed (pipeline, snowflake_path, snowflake_path_n);
}