Skip to content

Commit

Permalink
Add GraphicsEngine 16 API support
Browse files Browse the repository at this point in the history
  • Loading branch information
nx10 committed Apr 13, 2024
1 parent dc46f97 commit 55866cd
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/generic_dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ class generic_dev : public std::enable_shared_from_this<generic_dev<T>>
virtual void dev_fill(SEXP path, int rule, const pGEcontext gc, pDevDesc dd) {}
virtual void dev_fillStroke(SEXP path, int rule, const pGEcontext gc, pDevDesc dd) {}

// R_GE_version >= 16
virtual void dev_glyph(int n, int *glyphs, double *x, double *y, SEXP font,
double size, int colour, double rot, pDevDesc dd) {};

// GRAPHICS DEVICE FEATURE FLAGS

bool m_df_cap = false;
Expand Down Expand Up @@ -304,9 +308,17 @@ class generic_dev : public std::enable_shared_from_this<generic_dev<T>>
cap[R_GE_capability_compositing] = cpp11::writable::integers({0});
cap[R_GE_capability_transformations] = cpp11::writable::integers({0});
cap[R_GE_capability_paths] = cpp11::writable::integers({0});
#if R_GE_version >= 16
cap[R_GE_capability_glyphs] = cpp11::writable::integers({0});
#endif
return cpp11::as_sexp(cap);
};
#endif
#if R_GE_version >= 16
dd->glyph = [](int n, int *glyphs, double *x, double *y, SEXP font,
double size, int colour, double rot, pDevDesc dd)
{ from_dd(dd)->dev_glyph(n, glyphs, x, y, font, size, colour, rot, dd); };
#endif

if (m_df_cap)
{
Expand Down Expand Up @@ -379,9 +391,12 @@ class generic_dev : public std::enable_shared_from_this<generic_dev<T>>
#if R_GE_version == 14
dd->deviceVersion = R_GE_deviceClip;
#endif
#if R_GE_version >= 15
#if R_GE_version == 15
dd->deviceVersion = R_GE_group;
#endif
#if R_GE_version >= 16
dd->deviceVersion = R_GE_glyphs;
#endif

// Device specific
dd->deviceSpecific = t_device_specific;
Expand Down

0 comments on commit 55866cd

Please sign in to comment.