forked from davidgohel/ggiraph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclip.h
50 lines (39 loc) · 1.28 KB
/
clip.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* DSVG device - ClipPath elements
*/
#ifndef DSVG_CLIP_INCLUDED
#define DSVG_CLIP_INCLUDED
#include "indexed.h"
/*
* Class for indexing clip elements
*/
class Clips : public IndexedElements {
public:
/*
* Constructor
*
* prefix_ The svg canvas id
*/
Clips(const std::string& prefix_) : IndexedElements(prefix_, "_c") {}
/*
* Overload of inherited method
*
* key Optional string key. If specified, the clip index is added to an internal map.
* The simple clips (via dsvg_clip) can use this, to avoid duplication of clip definitions.
*/
INDEX push(SVGElement* el, const char* key = NULL);
/* Returns the index of a clip with specified key or NULL if not found */
INDEX find(const std::string& key) const;
/* Returns a key for the clip, using rect coords */
static std::string make_key(const double& x0, const double& x1,
const double& y0, const double& y1);
private:
/* map with clip indices by key */
std::unordered_map<std::string, INDEX> map;
};
void dsvg_clip(double x0, double x1, double y0, double y1, pDevDesc dd);
#if R_GE_version >= 13
SEXP dsvg_set_clip_path(SEXP path, SEXP ref, pDevDesc dd);
void dsvg_release_clip_path(SEXP ref, pDevDesc dd);
#endif // R_GE_version >= 13
#endif // DSVG_CLIP_INCLUDED