if (legendStyle.isRoundedRectangle) {
graphics.setColor(legendStyle.backgroundColor);
graphics.fillRoundRect(round(x), round(y), round(w), round(h), 15, 15);
graphics.setColor(legendStyle.foregroundColor);
graphics.setBackground(legendStyle.backgroundColor);
graphics.drawRoundRect(round(x), round(y), round(w), round(h), 15, 15);
} else {
graphics.setColor(legendStyle.backgroundColor);
graphics.fillRect(round(x), round(y), round(w), round(h));
graphics.setColor(legendStyle.foregroundColor);
graphics.setBackground(legendStyle.backgroundColor);