aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2016-09-21 15:27:53 +0200
committerThomas White <taw@bitwiz.org.uk>2016-09-21 15:27:53 +0200
commitfed1bb69cd8aca704b5f0aa36dc2a90ff1e8c53a (patch)
tree42d89092e49ddc2551458ae7f9dd6183a4b66919
parent6c5b9480352251c2d221eb7997fdd6dd358d7366 (diff)
Add colour boxes to test card
-rw-r--r--data/demo.sc2
-rw-r--r--src/testcard.c41
2 files changed, 41 insertions, 2 deletions
diff --git a/data/demo.sc b/data/demo.sc
index aa0a67c..71a0e12 100644
--- a/data/demo.sc
+++ b/data/demo.sc
@@ -34,6 +34,6 @@ What is the narrative window for? Well, it's up to you! Here are some suggesti
\bp{}Write bullet-pointed notes to structure your talk.
\bp{}Create a written version of your talk to print out and give to your audience as a handout.
Besides this, Colloquium has some features which will help you when you come to give your presentation. In the "Tools" menu, you'll find the presentation clock and the test card.
-Use the test card to make sure your computer is talking to the projector correctly. It's fairly self-explanatory...
+Use the test card to make sure your computer is talking to the projector correctly. It shows you the resolution of the screen, where it thinks the edges are, and some colours. This helps you spot and fix all-too-common display problems early.
Here's how the presentation clock works:
\slide{}
diff --git a/src/testcard.c b/src/testcard.c
index 35c6568..8928463 100644
--- a/src/testcard.c
+++ b/src/testcard.c
@@ -85,6 +85,28 @@ static void arrow_up(cairo_t *cr, double size)
}
+static void colour_box(cairo_t *cr, double x, double y,
+ double r, double g, double b, const char *label)
+{
+ const double w = 50.0;
+ const double h = 50.0;
+ cairo_text_extents_t size;
+
+ cairo_rectangle(cr, x+0.5, y+0.5, w, h);
+ cairo_set_source_rgb(cr, r, g, b);
+ cairo_fill_preserve(cr);
+ cairo_set_source_rgb(cr, 0.0, 0.0, 0.0);
+ cairo_set_line_width(cr, 1.0);
+ cairo_stroke(cr);
+
+ cairo_set_font_size(cr, 24.0);
+ cairo_text_extents(cr, label, &size);
+ cairo_move_to(cr, x+(w/2.0)-(size.width/2.0), y-10.0);
+ cairo_show_text(cr, label);
+
+}
+
+
static gboolean draw_sig(GtkWidget *da, cairo_t *cr, struct testcard *tc)
{
double xoff, yoff;
@@ -129,7 +151,7 @@ static gboolean draw_sig(GtkWidget *da, cairo_t *cr, struct testcard *tc)
pango_layout_get_size(pl, &plw, &plh);
plw = pango_units_to_double(plw);
plh = pango_units_to_double(plh);
- cairo_move_to(cr, (width-plw)/2, (height-plh)/2);
+ cairo_move_to(cr, (width-plw)/2, 200.0);
cairo_set_source_rgb(cr, 0.0, 0.0, 0.0);
pango_cairo_show_layout(cr, pl);
@@ -162,6 +184,23 @@ static gboolean draw_sig(GtkWidget *da, cairo_t *cr, struct testcard *tc)
cairo_move_to(cr, 100+tc->slide_width/2, 0.0);
arrow_up(cr, 80.0);
cairo_fill(cr);
+
+ /* Colour boxes */
+ colour_box(cr, 300, 400, 1.0, 0.0, 0.0, "Red");
+ colour_box(cr, 380, 400, 0.0, 1.0, 0.0, "Green");
+ colour_box(cr, 460, 400, 0.0, 0.0, 1.0, "Blue");
+ colour_box(cr, 540, 400, 1.0, 1.0, 0.0, "Yellow");
+ colour_box(cr, 620, 400, 1.0, 0.0, 1.0, "Pink");
+ colour_box(cr, 700, 400, 0.0, 1.0, 1.0, "Cyan");
+
+ /* Shades of grey */
+ double i;
+ for ( i=0; i<=1.0; i+=0.2 ) {
+ char label[32];
+ snprintf(label, 31, "%.0f%%", i*100.0);
+ colour_box(cr, 300+(i*5*80), 520, i, i, i, label);
+ }
+
return FALSE;
}