diff options
author | Thomas White <taw@bitwiz.org.uk> | 2011-02-27 20:26:27 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:15 +0100 |
commit | 6f12fbf4eb971e64d98449e2549f2c9b9f0fc6e1 (patch) | |
tree | 5211d952cd52afe2484f0352d00a9eb73cfbca72 /src/displaywindow.c | |
parent | 0874634448299691ab5891dee45f0bf275dff07c (diff) |
Make rendering work
Diffstat (limited to 'src/displaywindow.c')
-rw-r--r-- | src/displaywindow.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/displaywindow.c b/src/displaywindow.c index cb985b64..1c60add6 100644 --- a/src/displaywindow.c +++ b/src/displaywindow.c @@ -116,6 +116,8 @@ static gboolean displaywindow_expose(GtkWidget *da, GdkEventExpose *event, { cairo_t *cr; int i; + cairo_matrix_t basic_m; + cairo_matrix_t m; cr = gdk_cairo_create(da->window); @@ -125,6 +127,14 @@ static gboolean displaywindow_expose(GtkWidget *da, GdkEventExpose *event, cairo_set_source_rgb(cr, 0.5, 0.5, 0.5); cairo_fill(cr); + /* Set up basic coordinate system + * - origin in the centre, y upwards. */ + cairo_identity_matrix(cr); + cairo_translate(cr, dw->width/2.0, dw->height/2.0); + cairo_matrix_init(&m, 1.0, 0.0, 0.0, -1.0, 0.0, 0.0); + cairo_transform(cr, &m); + cairo_get_matrix(cr, &basic_m); + if ( dw->pixbufs != NULL ) { int i; @@ -136,10 +146,13 @@ static gboolean displaywindow_expose(GtkWidget *da, GdkEventExpose *event, int h = gdk_pixbuf_get_height(dw->pixbufs[i]); cairo_matrix_t m; - cairo_identity_matrix(cr); - cairo_translate(cr, dw->width/2.0, dw->height/2.0); + /* Start with the basic coordinate system */ + cairo_set_matrix(cr, &basic_m); + + /* Move to the right location */ cairo_translate(cr, p.cx/dw->binning, p.cy/dw->binning); + /* Twiddle directions according to matrix */ cairo_matrix_init(&m, p.fsx, p.fsy, p.ssx, p.ssy, 0.0, 0.0); cairo_transform(cr, &m); @@ -153,6 +166,12 @@ static gboolean displaywindow_expose(GtkWidget *da, GdkEventExpose *event, } + cairo_identity_matrix(cr); + cairo_translate(cr, dw->width/2.0, dw->height/2.0); + cairo_arc(cr, 0.0, 0.0, 5.0/dw->binning, 0.0, 2.0*M_PI); + cairo_set_source_rgb(cr, 1.0, 0.0, 0.0); + cairo_fill(cr); + if ( (dw->show_col_scale) && (dw->col_scale != NULL) ) { cairo_identity_matrix(cr); cairo_translate(cr, dw->width, 0.0); |