[cairo] Dashed line issue with CAIRO_ANTIALIAS_NONE option
Deokjin Kim
deokjin81.kim at samsung.com
Tue Nov 22 02:42:55 PST 2011
Hello everyone,
When I use dashed line without antialias(AA), half is displayed as unbroken line and half is displayed as dashed line.
I used the latest cairo source code from git.(1.11.3)
And I set ctm matrix for scale.
(For reference, 1.10.2 also have similar issue. But phenomenon is slightly different.
For example, some portion is displayed thickly)
Below is my test code.
######################################################################
#include <cairo.h>
#include <stdio.h>
#include <sys/time.h>
int
main (int argc, char *argv[])
{
cairo_surface_t *surface;
cairo_t *cr;
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 480, 480);
cr = cairo_create (surface);
double dashes[] = {1.0};
int ndash = sizeof (dashes)/sizeof(dashes[0]);
double offset = 1.0;
cairo_matrix_t scale;
scale.xy = scale.yx = 0.;
scale.xx = scale.yy = 1.5037590265274048;
scale.x0 = scale.y0 = 0.;
cairo_set_matrix (cr, &scale);
cairo_set_miter_limit (cr, 10.0);
cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
cairo_set_line_join (cr, CAIRO_LINE_JOIN_MITER);
cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
cairo_set_dash (cr, dashes, ndash, offset);
cairo_set_line_width (cr, 1.0);
cairo_move_to (cr, 20, 20);
cairo_line_to (cr, 480, 20);
cairo_stroke (cr);
/* Write output and clean up */
cairo_surface_write_to_png (surface, "dash_test.png");
cairo_destroy (cr);
cairo_surface_destroy (surface);
return 0;
}
######################################################################
Please give me a feedback.
Thank you in advance.
BR,
Deokjin Kim
More information about the cairo
mailing list