400 |
struct graphics2d *src = NULL, *dst = NULL; |
struct graphics2d *src = NULL, *dst = NULL; |
401 |
gint s_height, s_width, d_height, d_width, height, width; |
gint s_height, s_width, d_height, d_width, height, width; |
402 |
cairo_matrix_t *matrix; |
cairo_matrix_t *matrix; |
|
GdkGC *gc; |
|
403 |
cairo_operator_t tmp_op; |
cairo_operator_t tmp_op; |
404 |
|
|
405 |
gdk_threads_enter(); |
gdk_threads_enter(); |
604 |
negate offsets. oh well. |
negate offsets. oh well. |
605 |
|
|
606 |
*/ |
*/ |
607 |
|
{ |
608 |
double a = (x2 - x1 == 0.) ? 0. : ((cyclic ? 3.0 : 2.0) / (x2 - x1)); |
double a = (x2 - x1 == 0.) ? 0. : ((cyclic ? 3.0 : 2.0) / (x2 - x1)); |
609 |
double c = (y2 - y1 == 0.) ? 0. : (1. / (y2 - y1)); |
double c = (y2 - y1 == 0.) ? 0. : (1. / (y2 - y1)); |
610 |
double dx = (x1 == 0.) ? 0. : 1. / x1; |
double dx = (x1 == 0.) ? 0. : 1. / x1; |
611 |
double dy = (y1 == 0.) ? 0. : 1. / y1; |
double dy = (y1 == 0.) ? 0. : 1. / y1; |
612 |
|
|
613 |
cairo_matrix_set_affine (mat, |
cairo_matrix_set_affine (mat, |
614 |
a, 0., |
a, 0., |
615 |
c, 0., |
c, 0., |
616 |
dx, dy); |
dx, dy); |
617 |
|
|
618 |
cairo_surface_set_matrix (surf, mat); |
cairo_surface_set_matrix (surf, mat); |
619 |
cairo_matrix_destroy (mat); |
cairo_matrix_destroy (mat); |
620 |
cairo_surface_set_filter (surf, CAIRO_FILTER_BILINEAR); |
cairo_surface_set_filter (surf, CAIRO_FILTER_BILINEAR); |
621 |
|
} |
622 |
|
|
623 |
/* FIXME: repeating gradients (not to mention hold gradients) don't seem to work. */ |
/* FIXME: repeating gradients (not to mention hold gradients) don't seem to work. */ |
624 |
/* cairo_surface_set_repeat (surf, cyclic ? 1 : 0); */ |
/* cairo_surface_set_repeat (surf, cyclic ? 1 : 0); */ |
751 |
jint i, px; |
jint i, px; |
752 |
|
|
753 |
gdk_threads_enter(); |
gdk_threads_enter(); |
754 |
if (peer_is_disposed(env, obj)) { gdk_threads_leave(); return; } |
if (peer_is_disposed(env, obj)) { gdk_threads_leave(); return NULL; } |
755 |
|
|
756 |
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj); |
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj); |
757 |
g_assert (gr != NULL); |
g_assert (gr != NULL); |