aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--VERSION2
-rw-r--r--canvas.lv2/canvas.h3
-rw-r--r--canvas.lv2/forge.h9
-rw-r--r--canvas.lv2/render.h26
4 files changed, 38 insertions, 2 deletions
diff --git a/VERSION b/VERSION
index e01fa85..a6c8cf7 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.3.27
+0.3.29
diff --git a/canvas.lv2/canvas.h b/canvas.lv2/canvas.h
index d6ca8de..7cca0fa 100644
--- a/canvas.lv2/canvas.h
+++ b/canvas.lv2/canvas.h
@@ -56,6 +56,7 @@ extern "C" {
#define CANVAS__Translate CANVAS_PREFIX"Translate"
#define CANVAS__Scale CANVAS_PREFIX"Scale"
#define CANVAS__Rotate CANVAS_PREFIX"Rotate"
+#define CANVAS__Transform CANVAS_PREFIX"Transform"
#define CANVAS__Reset CANVAS_PREFIX"Reset"
#define CANVAS__FontSize CANVAS_PREFIX"FontSize"
#define CANVAS__FillText CANVAS_PREFIX"FillText"
@@ -108,6 +109,7 @@ struct _LV2_Canvas_URID {
LV2_URID Canvas_Translate;
LV2_URID Canvas_Scale;
LV2_URID Canvas_Rotate;
+ LV2_URID Canvas_Transform;
LV2_URID Canvas_Reset;
LV2_URID Canvas_FontSize;
LV2_URID Canvas_FillText;
@@ -161,6 +163,7 @@ lv2_canvas_urid_init(LV2_Canvas_URID *urid, LV2_URID_Map *map)
urid->Canvas_Translate = map->map(map->handle, CANVAS__Translate);
urid->Canvas_Scale = map->map(map->handle, CANVAS__Scale);
urid->Canvas_Rotate = map->map(map->handle, CANVAS__Rotate);
+ urid->Canvas_Transform = map->map(map->handle, CANVAS__Transform);
urid->Canvas_Reset = map->map(map->handle, CANVAS__Reset);
urid->Canvas_FontSize = map->map(map->handle, CANVAS__FontSize);
urid->Canvas_FillText = map->map(map->handle, CANVAS__FillText);
diff --git a/canvas.lv2/forge.h b/canvas.lv2/forge.h
index 43aa1d5..c5ce5fe 100644
--- a/canvas.lv2/forge.h
+++ b/canvas.lv2/forge.h
@@ -291,6 +291,15 @@ lv2_canvas_forge_rotate(LV2_Atom_Forge *forge, LV2_Canvas_URID *urid,
}
static inline LV2_Atom_Forge_Ref
+lv2_canvas_forge_transform(LV2_Atom_Forge *forge, LV2_Canvas_URID *urid,
+ float xx, float xy, float x0, float yy, float yx, float y0)
+{
+ const float vec [6] = {xx, xy, x0, yy, yx, y0};
+
+ return _lv2_canvas_forge_vec(forge, urid, urid->Canvas_Transform, 6, vec);
+}
+
+static inline LV2_Atom_Forge_Ref
lv2_canvas_forge_reset(LV2_Atom_Forge *forge, LV2_Canvas_URID *urid)
{
return _lv2_canvas_forge_simple(forge, urid->Canvas_Reset);
diff --git a/canvas.lv2/render.h b/canvas.lv2/render.h
index 50683e6..2882c87 100644
--- a/canvas.lv2/render.h
+++ b/canvas.lv2/render.h
@@ -28,7 +28,7 @@
extern "C" {
#endif
-#define LV2_CANVAS_NUM_METHODS 25
+#define LV2_CANVAS_NUM_METHODS 26
typedef struct _LV2_Canvas_Meth LV2_Canvas_Meth;
typedef struct _LV2_Canvas LV2_Canvas;
@@ -341,6 +341,27 @@ _lv2_canvas_render_rotate(cairo_t *ctx,
}
static inline void
+_lv2_canvas_render_transform(cairo_t *ctx,
+ LV2_Canvas_URID *urid, const LV2_Atom *body)
+{
+ const float *v = _lv2_canvas_render_get_float_vec(urid, body, 6);
+
+ if(v)
+ {
+ const cairo_matrix_t matrix = {
+ .xx = v[0],
+ .xy = v[1],
+ .x0 = v[2],
+ .yy = v[3],
+ .yx = v[4],
+ .y0 = v[5]
+ };
+
+ cairo_transform(ctx, &matrix);
+ }
+}
+
+static inline void
_lv2_canvas_render_reset(cairo_t *ctx,
LV2_Canvas_URID *urid, const LV2_Atom *body)
{
@@ -497,6 +518,9 @@ lv2_canvas_init(LV2_Canvas *canvas, LV2_URID_Map *map)
canvas->methods[ptr].command = canvas->urid.Canvas_Rotate;
canvas->methods[ptr++].func = _lv2_canvas_render_rotate;
+ canvas->methods[ptr].command = canvas->urid.Canvas_Transform;
+ canvas->methods[ptr++].func = _lv2_canvas_render_transform;
+
canvas->methods[ptr].command = canvas->urid.Canvas_Reset;
canvas->methods[ptr++].func = _lv2_canvas_render_reset;