Skip to content
Snippets Groups Projects

Added optional 2d controls that to allow moving and zooming vector images.

Merged Julius Nehring-Wirxel requested to merge feature-2d-controls into develop
12 files
+ 92
11
Compare changes
  • Side-by-side
  • Inline
Files
12
@@ -144,6 +144,19 @@ void ogl_context::render(const image2D& img) const
void reset_clip() { nvgResetScissor(vg); }
void global_alpha(float a) { nvgGlobalAlpha(vg, a); }
// void reset_transform() { nvgResetTransform(vg); }
// void apply_transform(float a, float b, float c, float d, float e, float f) { nvgTransform(vg, a, b, c, d, e, f); }
// void set_transform(float a, float b, float c, float d, float e, float f)
// {
// reset_transform();
// apply_transform(a, b, c, d, e, f);
// }
// void translate(float x, float y) { return nvgTranslate(vg, x, y); }
// void rotate(float angle) { nvgRotate(vg, angle); }
// void skew_x(float angle) { nvgSkewX(vg, angle); }
// void skew_y(float angle) { nvgSkewY(vg, angle); }
// void scale(float x, float y) { nvgScale(vg, x, y); }
};
visit(img, nvg_renderer{vg});
@@ -199,6 +212,15 @@ ogl_context OGLRenderer::frame(float w, float h, float devicePixelRatio) const
nvgBeginFrame(vg, w, h, devicePixelRatio);
nvgResetTransform(vg);
nvgTransform(vg, //
global_transform[0][0], //
global_transform[0][1], //
global_transform[1][0], //
global_transform[1][1], //
global_transform[2][0], //
global_transform[2][1]);
return {vg, bool(was_blending_enabled)};
}
Loading