cairo_paint (cr);
cairo_restore (cr);
- cairo_set_antialias (cr, CAIRO_ANTIALIAS_DEFAULT);
+ cairo_set_antialias (cr, CAIRO_ANTIALIAS_GRAY);
/* Set scale and offset */
w = width - 1;
gl_debug (DEBUG_MINI_PREVIEW, "START");
cairo_save (cr);
+ //cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
cairo_rectangle (cr, 0.0, 0.0, template->page_width, template->page_height);
- cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
+ cairo_set_source_rgb (cr, 0.95, 0.95, 0.95);
cairo_fill_preserve (cr);
cairo_set_line_width (cr, 1/scale);
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
cairo_save (cr);
cairo_set_line_width (cr, 1.0/scale);
- cairo_set_source_rgb (cr, 0.5, 0.5, 0.5);
label_type = gl_template_get_first_label_type (template);
cairo_save (cr);
+ //cairo_set_antialias (cr, CAIRO_ANTIALIAS_GRAY);
+
label_type = gl_template_get_first_label_type (template);
gl_template_get_label_size (label_type, &w, &h);
cairo_rectangle (cr, x0, y0, w, h);
+
+ cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
+ cairo_fill_preserve (cr);
+
+ cairo_set_source_rgb (cr, 0.25, 0.25, 0.25);
cairo_stroke (cr);
cairo_restore (cr);
cairo_save (cr);
+ //cairo_set_antialias (cr, CAIRO_ANTIALIAS_GRAY);
+
label_type = gl_template_get_first_label_type (template);
gl_template_get_label_size (label_type, &w, &h);
cairo_arc (cr, x0+w/2, y0+h/2, w/2, 0.0, 2*M_PI);
+
+ cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
+ cairo_fill_preserve (cr);
+
+ cairo_set_source_rgb (cr, 0.25, 0.25, 0.25);
cairo_stroke (cr);
cairo_restore (cr);
gdouble w, h;
gdouble xc, yc;
gdouble r1, r2;
+ gdouble theta1, theta2;
+
gl_debug (DEBUG_MINI_PREVIEW, "START");
cairo_save (cr);
+ //cairo_set_antialias (cr, CAIRO_ANTIALIAS_GRAY);
+
label_type = gl_template_get_first_label_type (template);
gl_template_get_label_size (label_type, &w, &h);
r1 = label_type->size.cd.r1;
r2 = label_type->size.cd.r2;
- if ( w == h )
- {
- /* Simple CD */
- cairo_arc (cr, xc, yc, r1, 0.0, 2*M_PI);
- cairo_stroke (cr);
- }
- else
- {
- /* Credit Card CD (One or both dimensions trucated) */
- gdouble theta1, theta2;
-
- theta1 = acos (w / (2.0*r1));
- theta2 = asin (h / (2.0*r1));
-
- cairo_new_path (cr);
- cairo_arc (cr, xc, yc, r1, theta1, theta2);
- cairo_arc (cr, xc, yc, r1, M_PI-theta2, M_PI-theta1);
- cairo_arc (cr, xc, yc, r1, M_PI+theta1, M_PI+theta2);
- cairo_arc (cr, xc, yc, r1, 2*M_PI-theta2, 2*M_PI-theta1);
- cairo_close_path (cr);
- cairo_stroke (cr);
- }
+ theta1 = acos (w / (2.0*r1));
+ theta2 = asin (h / (2.0*r1));
+
+ /* Outer radius, may be clipped in the case of business card CDs. */
+ /* Do as a series of 4 arcs, to account for clipping. */
+ cairo_new_path (cr);
+ cairo_arc (cr, xc, yc, r1, theta1, theta2);
+ cairo_arc (cr, xc, yc, r1, M_PI-theta2, M_PI-theta1);
+ cairo_arc (cr, xc, yc, r1, M_PI+theta1, M_PI+theta2);
+ cairo_arc (cr, xc, yc, r1, 2*M_PI-theta2, 2*M_PI-theta1);
+ cairo_close_path (cr);
/* Hole */
+ cairo_new_sub_path (cr);
cairo_arc (cr, xc, yc, r2, 0.0, 2*M_PI);
+
+ cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
+ cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
+ cairo_fill_preserve (cr);
+
+ cairo_set_source_rgb (cr, 0.25, 0.25, 0.25);
cairo_stroke (cr);
cairo_restore (cr);
const glTemplateLabelType *label_type;
gdouble w, h;
gdouble r1, r2;
+ gdouble theta1, theta2;
gl_debug (DEBUG_MINI_PREVIEW, "START");
r1 = label_type->size.cd.r1;
r2 = label_type->size.cd.r2;
- if ( w == h )
- {
- /* Simple CD */
- cairo_arc (cr, 0.0, 0.0, r1, 0.0, 2*M_PI);
- }
- else
- {
- /* Credit Card CD (One or both dimensions trucated) */
- gdouble theta1, theta2;
-
- theta1 = acos (w / (2.0*r1));
- theta2 = asin (h / (2.0*r1));
-
- cairo_new_path (cr);
- cairo_arc (cr, 0.0, 0.0, r1, theta1, theta2);
- cairo_arc (cr, 0.0, 0.0, r1, M_PI-theta2, M_PI-theta1);
- cairo_arc (cr, 0.0, 0.0, r1, M_PI+theta1, M_PI+theta2);
- cairo_arc (cr, 0.0, 0.0, r1, 2*M_PI-theta2, 2*M_PI-theta1);
- cairo_close_path (cr);
- }
+ /* Outer radius, may be clipped in the case of business card CDs. */
+ /* Do as a series of 4 arcs, to account for clipping. */
+ theta1 = acos (w / (2.0*r1));
+ theta2 = asin (h / (2.0*r1));
+
+ cairo_new_path (cr);
+ cairo_arc (cr, 0.0, 0.0, r1, theta1, theta2);
+ cairo_arc (cr, 0.0, 0.0, r1, M_PI-theta2, M_PI-theta1);
+ cairo_arc (cr, 0.0, 0.0, r1, M_PI+theta1, M_PI+theta2);
+ cairo_arc (cr, 0.0, 0.0, r1, 2*M_PI-theta2, 2*M_PI-theta1);
+ cairo_close_path (cr);
+
+ /* Hole */
+ cairo_new_sub_path (cr);
+ cairo_arc (cr, 0.0, 0.0, r2, 0.0, 2*M_PI);
+
cairo_set_source_rgb (cr,
GL_COLOR_F_RED(fill_color),
GL_COLOR_F_GREEN(fill_color),
GL_COLOR_F_BLUE(fill_color));
+ cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_fill_preserve (cr);
cairo_set_source_rgb (cr,
GL_COLOR_F_BLUE(line_color));
cairo_stroke (cr);
- /* Hole */
- cairo_arc (cr, 0.0, 0.0, r2, 0.0, 2*M_PI);
- cairo_stroke (cr);
-
cairo_restore (cr);
gl_debug (DEBUG_MINI_PREVIEW, "END");