Skip to content

Commit

Permalink
Fix #162
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasp85 committed Mar 15, 2024
1 parent 4b0b74e commit 25eedc4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# ragg (development version)

* Make sure the linejoin/linemitre setting is honored when drawing rectangles
(#162)

# ragg 1.3.0

* Added supported for new graphics enigine features: Groups, paths, luminance
Expand Down
8 changes: 5 additions & 3 deletions src/AggDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ class AggDevice {
void drawCircle(double x, double y, double r, int fill, int col, double lwd,
int lty, R_GE_lineend lend, int pattern);
void drawRect(double x0, double y0, double x1, double y1, int fill, int col,
double lwd, int lty, R_GE_lineend lend, int pattern);
double lwd, int lty, R_GE_lineend lend, R_GE_linejoin ljoin,
double lmitre, int pattern);
void drawPolygon(int n, double *x, double *y, int fill, int col, double lwd,
int lty, R_GE_lineend lend, R_GE_linejoin ljoin,
double lmitre, int pattern);
Expand Down Expand Up @@ -1141,7 +1142,8 @@ template<class PIXFMT, class R_COLOR, typename BLNDFMT>
void AggDevice<PIXFMT, R_COLOR, BLNDFMT>::drawRect(double x0, double y0, double x1,
double y1, int fill, int col,
double lwd, int lty,
R_GE_lineend lend, int pattern) {
R_GE_lineend lend, R_GE_linejoin ljoin,
double lmitre, int pattern) {
bool draw_fill = visibleColour(fill) || pattern != -1;
bool draw_stroke = visibleColour(col) && lwd > 0.0 && lty != LTY_BLANK;

Expand Down Expand Up @@ -1170,7 +1172,7 @@ void AggDevice<PIXFMT, R_COLOR, BLNDFMT>::drawRect(double x0, double y0, double
rect.line_to(x1, y0);
rect.close_polygon();

drawShape(ras, ras_clip, rect, draw_fill, draw_stroke, fill, col, lwd, lty, lend, GE_ROUND_JOIN, 1.0, pattern);
drawShape(ras, ras_clip, rect, draw_fill, draw_stroke, fill, col, lwd, lty, lend, ljoin, lmitre, pattern);
}

template<class PIXFMT, class R_COLOR, typename BLNDFMT>
Expand Down
2 changes: 1 addition & 1 deletion src/init_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void agg_rect(double x0, double y0, double x1, double y1, const pGEcontext gc,

BEGIN_CPP
device->drawRect(x0, y0, x1, y1, gc->fill, gc->col, gc->lwd,
gc->lty, gc->lend, pattern);
gc->lty, gc->lend, gc->ljoin, gc->lmitre, pattern);
END_CPP

return;
Expand Down

0 comments on commit 25eedc4

Please sign in to comment.