Exemplo n.º 1
0
static void
test_dist (void)
{
    ArtVpath *vpath;
    ArtSVP *svp;
    art_u8 buf[512 * 512 * BYTES_PP];
    int x, y;
    int ix;
    double dist;
    int wind;

    vpath = randstar (20);
#ifdef NO_STROKE
    svp = art_svp_from_vpath (vpath);
#else
    svp = art_svp_vpath_stroke (vpath,
                                ART_PATH_STROKE_JOIN_MITER,
                                ART_PATH_STROKE_CAP_BUTT,
                                15,
                                4,
                                0.5);
#endif

    art_rgb_svp_aa (svp, 0, 0, 512, 512,
                    0xffe0a0, 0x100040,
                    buf, 512 * BYTES_PP,
                    NULL);

    ix = 0;
    for (y = 0; y < 512; y++)
    {
        for (x = 0; x < 512; x++)
        {
            wind = art_svp_point_wind (svp, x, y);
            buf[ix] = 204 - wind * 51;
            dist = art_svp_point_dist (svp, x, y);
            if (((x | y) & 0x3f) == 0)
            {
                fprintf (stderr, "%d,%d: %f\n", x, y, dist);
            }
            buf[ix + 1] = 255 - dist;
            ix += 3;
        }
    }

    printf ("P6\n512 512\n255\n");
    fwrite (buf, 1, 512 * 512 * BYTES_PP, stdout);

}
Exemplo n.º 2
0
gboolean hittest_point(ArtSVP *lassosvp, double x, double y)
{
  return art_svp_point_wind(lassosvp, x, y)%2;
}