diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-08-29 09:59:36 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-08-29 17:10:05 +0100 |
commit | c60280782dfac7de1abe3230a500c7c98735dc02 (patch) | |
tree | d6b5577a2d582c1b7eb58bc305db32132cc36f1c /util/cairo-script | |
parent | 06ca0b1475caf709fdf32b10a891dfb3b47cc6b1 (diff) |
[script] Implement invert
Flesh out matrix inversion.
Diffstat (limited to 'util/cairo-script')
-rw-r--r-- | util/cairo-script/cairo-script-operators.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/util/cairo-script/cairo-script-operators.c b/util/cairo-script/cairo-script-operators.c index a07022a7..de5dd40c 100644 --- a/util/cairo-script/cairo-script-operators.c +++ b/util/cairo-script/cairo-script-operators.c @@ -3122,6 +3122,30 @@ _integer (csi_t *ctx) } static csi_status_t +_invert (csi_t *ctx) +{ + csi_object_t obj; + csi_status_t status; + cairo_matrix_t m; + + check (1); + + status = _csi_ostack_get_matrix (ctx, 0, &m); + if (_csi_unlikely (status)) + return status; + + cairo_matrix_invert (&m); + + status = csi_matrix_new_from_matrix (ctx, &obj, &m); + if (_csi_unlikely (status)) + return status; + + pop (1); + + return push (&obj); +} + +static csi_status_t _le (csi_t *ctx) { csi_status_t status; @@ -5768,7 +5792,7 @@ _defs[] = { { "image", _image }, { "index", _index }, { "integer", _integer }, - { "invert", NULL }, + { "invert", _invert }, { "in-stroke", NULL }, { "in-fill", NULL }, { "known", NULL }, |