1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-29 19:40:35 +00:00

svg:: circles now have better linewidth

This commit is contained in:
Zeno Rogue 2018-12-13 17:03:39 +01:00
parent 4d3f33deec
commit 8ba603fba3
4 changed files with 8 additions and 4 deletions

View File

@ -1872,7 +1872,7 @@ namespace shot {
}
namespace svg {
void circle(int x, int y, int size, color_t col, color_t fillcolor);
void circle(int x, int y, int size, color_t col, color_t fillcolor, double linewidth);
void polygon(int *polyx, int *polyy, int polyi, color_t col, color_t outline, double linewidth);
void text(int x, int y, int size, const string& str, bool frame, color_t col, int align);
extern bool in;
@ -2737,6 +2737,7 @@ struct dqi_string : drawqueueitem {
struct dqi_circle : drawqueueitem {
int x, y, size, fillcolor;
double linewidth;
void draw();
virtual color_t outline_group() { return 2; }
};

View File

@ -1270,6 +1270,8 @@ void draw_boundary(int w) {
ld fakeinf = sphere ? M_PI-1e-5 : hyperbolic ? 10 : exp(10);
dynamicval<ld> dw(vid.linewidth, vid.linewidth * (svg::in ? svg::divby : 1));
if(elliptic && !among(pmodel, mdBand, mdBandEquidistant, mdBandEquiarea, mdSinusoidal))
circle_around_center(M_PI/2, periodcolor, 0, PPR::CIRCLE);

View File

@ -1252,7 +1252,7 @@ void dqi_string::draw() {
void dqi_circle::draw() {
#if ISMOBILE==0
if(svg::in) {
svg::circle(x, y, size, color, fillcolor);
svg::circle(x, y, size, color, fillcolor, linewidth);
}
else
#endif
@ -2777,6 +2777,7 @@ void queuecircle(int x, int y, int size, color_t color, PPR prio = PPR::CIRCLE,
ptd.size = size;
ptd.color = color;
ptd.fillcolor = fillcolor;
ptd.linewidth = vid.linewidth;
}
void getcoord0(const hyperpoint& h, int& xc, int &yc, int &sc) {

View File

@ -74,10 +74,10 @@ namespace svg {
return buf;
}
void circle(int x, int y, int size, color_t col, color_t fillcol) {
void circle(int x, int y, int size, color_t col, color_t fillcol, double linewidth) {
if(!invisible(col) || !invisible(fillcol)) {
if(vid.stretch == 1)
println(f, "<circle cx='", coord(x), "' cy='", coord(y), "' r='", coord(size), "' ", stylestr(fillcol, col), "/>");
println(f, "<circle cx='", coord(x), "' cy='", coord(y), "' r='", coord(size), "' ", stylestr(fillcol, col, linewidth), "/>");
else
println(f, "<ellipse cx='", coord(x), "' cy='", coord(y), "' rx='", coord(size), "' ry='", coord(size*vid.stretch), "' ", stylestr(fillcol, col), "/>");
}