예제 #1
0
파일: plot_ps.c 프로젝트: Gilles86/afni
void ps_epilog( void )
{ ps_clear();
#ifdef USE_EOT
  fprintf( psfile , "%%%%Trailer\n%%%%Pages: %d\n%c", npages,4); /* inc. EOT */
#else
  fprintf( psfile , "%%%%Trailer\n%%%%Pages: %d\n", npages); /* no EOT */
#endif
}
예제 #2
0
파일: plot_ps.c 프로젝트: Gilles86/afni
void ps_erase( void )
{ ps_clear() ; }
예제 #3
0
void on_draw(ps_context* gc)
{
    int i;
    ps_color color = {1, 1, 1, 1};
    ps_set_source_color(gc, &color);
    ps_clear(gc);

    ps_set_line_cap(gc, LINE_CAP_BUTT);
    ps_set_composite_operator(gc, COMPOSITE_SRC_OVER);

    ps_identity(gc);
    ps_set_matrix(gc, adjust);
    ps_scale(gc, (float)scale, (float)scale);

    // draw background
    ps_set_source_gradient(gc, shadowGradient);
    ps_set_path(gc, shadowPath);
    ps_fill(gc);

    // draw quadrant
    ps_set_source_gradient(gc, quadrantGradient);
    ps_set_path(gc, quadrantPath);
    ps_fill(gc);

    ps_identity(gc);
    ps_scale(gc, (float)scale, (float)scale);
    // draw inner bevel
    ps_set_source_gradient(gc, bevelsGradient);
    ps_set_fill_rule(gc, FILL_RULE_EVEN_ODD);
    ps_set_path(gc, innerBevelPath);
    ps_fill(gc);

    ps_identity(gc);
    ps_translate(gc, -256, -256);
    ps_rotate(gc, (float)PI);
    ps_translate(gc, 256, 256);
    ps_scale(gc, (float)scale, (float)scale);

    ps_set_source_gradient(gc, bevelsGradient);
    ps_set_fill_rule(gc, FILL_RULE_EVEN_ODD);
    ps_set_path(gc, outerBevelPath);
    ps_fill(gc);

    // draw seconds tags
    {
        ps_color sc = {0.11f, 0.12f, 0.13f, 0.65f};
        ps_set_line_width(gc, 2.0f);
        ps_set_line_cap(gc, LINE_CAP_ROUND);
        ps_set_stroke_color(gc, &sc);
        for (i = 0; i < 60; i++) {
            if ((i % 5) != 0) {
                ps_identity(gc);
                ps_translate(gc, -256, -256);
                ps_rotate(gc, 2 * PI - ((float)i/60.0f) * PI * 2);
                ps_translate(gc, 256, 256);
                ps_scale(gc, (float)scale, (float)scale);
                ps_set_path(gc, secondTagPath);
                ps_stroke(gc);
            }
        }

        // draw hours and milliseconds tags
        for (i = 0; i < 12; i++) {
            float rot = 2 * PI - (((float)i / 12.0f) * PI * 2);
            ps_set_line_width(gc, 7.0);
            ps_identity(gc);
            ps_translate(gc, -256, -256);
            ps_rotate(gc, (float)rot);
            ps_translate(gc, 256, 256);
            ps_scale(gc, (float)scale, (float)scale);
            ps_set_path(gc, hourTagPath);
            ps_stroke(gc);

            ps_set_line_width(gc, 2.0);
            ps_identity(gc);
            ps_translate(gc, -356, -256);
            ps_rotate(gc, (float)rot);
            ps_translate(gc, 356, 256);
            ps_scale(gc, (float)scale, (float)scale);
            ps_set_path(gc, msTagPath);
            ps_stroke(gc);
        }
    }
    //draw cursors
    {
        time_t ctime;
        struct tm *ltime;
        ctime = time(NULL);
        ltime = localtime(&ctime);
        drawCursors(gc, ltime->tm_hour, ltime->tm_min, ltime->tm_sec, millsecons);
    }
    //draw glass
    {
        ps_color gcol = {0.04f, 0.045f, 0.05f, 0.8f};
        ps_identity(gc);
        ps_set_matrix(gc, adjust);
        ps_scale(gc, (float)scale, (float)scale);
        ps_set_composite_operator(gc, COMPOSITE_PLUS);
        ps_set_source_color(gc, &gcol);
        ps_set_path(gc, glassPath);
        ps_fill(gc);
    }
}