Commit a6339b05 authored by twanvl's avatar twanvl

Softer colors in graphs, the border of bars etc. is now lerp(black,fill,0.5)...

Softer colors in graphs, the border of bars etc. is now lerp(black,fill,0.5) instead of just pure black.
Also tweaked the magic card_color graph colors a bit
parent a13c5009
...@@ -1198,7 +1198,7 @@ card field: ...@@ -1198,7 +1198,7 @@ card field:
card list color script: card list color script:
input := card.card_color input := card.card_color
if input == "white" then rgb(156,134,90) if input == "white" then rgb(156,130,90)
else if input == "blue" then rgb(0,64,168) else if input == "blue" then rgb(0,64,168)
else if input == "black" then rgb(0,0,0) else if input == "black" then rgb(0,0,0)
else if input == "red" then rgb(168,0,0) else if input == "red" then rgb(168,0,0)
...@@ -1209,7 +1209,7 @@ card list color script: ...@@ -1209,7 +1209,7 @@ card list color script:
multi := chosen(choice:"multicolor") multi := chosen(choice:"multicolor")
hybrid := chosen(choice:"hybrid") hybrid := chosen(choice:"hybrid")
if land then rgb(109,62,39) # land if land then rgb(109,62,39) # land
else if multi and input != "artifact, multicolor" then rgb(120,120,0) # multicolor else if multi and input != "artifact, multicolor" then rgb(130,110,0) # multicolor
else if hybrid then rgb(115,0,160) # hybrid else if hybrid then rgb(115,0,160) # hybrid
else if artifact then rgb(72,90,100) # artifact else if artifact then rgb(72,90,100) # artifact
else rgb(119,83,83) # colorless else rgb(119,83,83) # colorless
...@@ -1233,12 +1233,12 @@ statistics dimension: ...@@ -1233,12 +1233,12 @@ statistics dimension:
blue : rgb(42,141,255) blue : rgb(42,141,255)
black : rgb(33,33,33) black : rgb(33,33,33)
red : rgb(255,52,0) red : rgb(255,52,0)
green : rgb(138,230,0) green : rgb(118,230,0)
colorless : rgb(122,85,85) colorless : rgb(120,90,90)
artifact : rgb(188,192,195) artifact : rgb(185,192,199)
multicolor : rgb(255,188,14) multicolor : rgb(255,188,14)
land : rgb(109,62,39) land : rgb(109,62,39)
hybrid : rgb(243,26,136) hybrid : rgb(201,12,230)
group: white group: white
group: blue group: blue
group: black group: black
......
...@@ -274,12 +274,17 @@ void BarGraph::draw(RotatedDC& dc, int current, DrawLayer layer) const { ...@@ -274,12 +274,17 @@ void BarGraph::draw(RotatedDC& dc, int current, DrawLayer layer) const {
} }
} else if (layer == LAYER_VALUES) { } else if (layer == LAYER_VALUES) {
// Draw bars // Draw bars
dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); Color fg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
int i = 0; int i = 0;
FOR_EACH_CONST(g, axis.groups) { FOR_EACH_CONST(g, axis.groups) {
// draw bar // draw bar
dc.SetPen(i == current ? fg : lerp(fg,g.color,0.5));
dc.SetBrush(g.color); dc.SetBrush(g.color);
dc.DrawRectangle(bar_graph_bar(rect, i++, count, 0, g.size, axis.max)); RealRect bar = bar_graph_bar(rect, i++, count, 0, g.size, axis.max);
dc.DrawRectangle(bar);
// redraw axis part
dc.SetPen(fg);
dc.DrawLine(bar.bottomLeft()+Vector2D(0,-1), bar.bottomRight()+Vector2D(0,-1));
} }
} }
} }
...@@ -299,12 +304,12 @@ void BarGraph2D::draw(RotatedDC& dc, const vector<int>& current, DrawLayer layer ...@@ -299,12 +304,12 @@ void BarGraph2D::draw(RotatedDC& dc, const vector<int>& current, DrawLayer layer
GraphAxis& axis1 = axis1_data(); // the major axis GraphAxis& axis1 = axis1_data(); // the major axis
GraphAxis& axis2 = axis2_data(); // the stacked axis GraphAxis& axis2 = axis2_data(); // the stacked axis
int count = int(axis1.groups.size()); int count = int(axis1.groups.size());
int cur1 = this->axis1 < current.size() ? current[this->axis1] : -1;
int cur2 = this->axis2 < current.size() ? current[this->axis2] : -1;
// Draw // Draw
if (layer == LAYER_SELECTION) { if (layer == LAYER_SELECTION) {
// Highlight current column // Highlight current column
Color bg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); Color bg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
int cur1 = this->axis1 < current.size() ? current[this->axis1] : -1;
int cur2 = this->axis2 < current.size() ? current[this->axis2] : -1;
if (cur1 >= 0) { if (cur1 >= 0) {
// draw selected bar // draw selected bar
int start = 0; int start = 0;
...@@ -327,16 +332,29 @@ void BarGraph2D::draw(RotatedDC& dc, const vector<int>& current, DrawLayer layer ...@@ -327,16 +332,29 @@ void BarGraph2D::draw(RotatedDC& dc, const vector<int>& current, DrawLayer layer
} }
} else if (layer == LAYER_VALUES) { } else if (layer == LAYER_VALUES) {
// Draw bars // Draw bars
dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); Color fg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
for (int i = 0 ; i < count ; ++i) { for (int i = 0 ; i < count ; ++i) {
// draw stacked bars // draw stacked bars
int start = 0; int start = 0;
int j = 0; int j = 0;
Color prevColor = fg;
bool prevActive = true;
FOR_EACH_CONST(g2, axis2.groups) { FOR_EACH_CONST(g2, axis2.groups) {
int end = start + values[j++ + axis2.groups.size() * i]; bool active = !(cur1 == -1 && cur2 == -1) && (i == cur1 || cur1 == -1) && (j == cur2 || cur2 == -1);
dc.SetBrush(g2.color); int end = start + values[j + axis2.groups.size() * i];
dc.DrawRectangle(bar_graph_bar(rect, i, count, start, end, axis1.max)); if (start != end) {
start = end; dc.SetBrush(g2.color);
dc.SetPen(active ? fg : lerp(fg, g2.color, 0.5));
RealRect bar = bar_graph_bar(rect, i, count, start, end, axis1.max);
dc.DrawRectangle(bar);
// fix up line below
dc.SetPen(active || prevActive ? fg : lerp(fg,lerp(prevColor,g2.color,0.5),0.5));
dc.DrawLine(bar.bottomLeft()+Vector2D(0,-1), bar.bottomRight()+Vector2D(0,-1));
// next
prevActive = active;
prevColor = g2.color;
}
start = end; j++;
} }
} }
} }
...@@ -397,8 +415,10 @@ void PieGraph::draw(RotatedDC& dc, int current, DrawLayer layer) const { ...@@ -397,8 +415,10 @@ void PieGraph::draw(RotatedDC& dc, int current, DrawLayer layer) const {
// draw pie // draw pie
dc.SetBrush(g.color); dc.SetBrush(g.color);
if (g.size > 0) { if (g.size > 0) {
bool active = i == current;
dc.SetPen(active ? fg : lerp(fg,g.color,0.5));
double end_angle = angle - 2 * M_PI * (double)g.size / axis.total; double end_angle = angle - 2 * M_PI * (double)g.size / axis.total;
dc.DrawEllipticArc(pie_pos, i == current ? pie_size_large : pie_size, end_angle, angle); dc.DrawEllipticArc(pie_pos, active ? pie_size_large : pie_size, end_angle, angle);
angle = end_angle; angle = end_angle;
} }
++i; ++i;
...@@ -409,7 +429,10 @@ void PieGraph::draw(RotatedDC& dc, int current, DrawLayer layer) const { ...@@ -409,7 +429,10 @@ void PieGraph::draw(RotatedDC& dc, int current, DrawLayer layer) const {
double angle = M_PI/2; double angle = M_PI/2;
FOR_EACH_CONST(g, axis.groups) { FOR_EACH_CONST(g, axis.groups) {
if (true) { if (true) {
RealSize size = i == current || (i - 1 + (int)axis.groups.size()) % (int)axis.groups.size() == current ? pie_size_large : pie_size; int i2 = (i - 1 + (int)axis.groups.size()) % (int)axis.groups.size();
bool active = i == current || i2 == current;
dc.SetPen(active ? fg : lerp(fg,lerp(g.color,axis.groups[i2].color,0.5),0.5));
RealSize size = active ? pie_size_large : pie_size;
dc.DrawEllipticSpoke(pie_pos, size, angle); dc.DrawEllipticSpoke(pie_pos, size, angle);
angle -= 2 * M_PI * (double)g.size / axis.total; angle -= 2 * M_PI * (double)g.size / axis.total;
} }
...@@ -450,14 +473,14 @@ void ScatterGraph::draw(RotatedDC& dc, const vector<int>& current, DrawLayer lay ...@@ -450,14 +473,14 @@ void ScatterGraph::draw(RotatedDC& dc, const vector<int>& current, DrawLayer lay
RealRect rect = dc.getInternalRect(); RealRect rect = dc.getInternalRect();
GraphAxis& axis1 = axis1_data(); // the major axis GraphAxis& axis1 = axis1_data(); // the major axis
GraphAxis& axis2 = axis2_data(); // the stacked axis GraphAxis& axis2 = axis2_data(); // the stacked axis
int cur1 = this->axis1 < current.size() ? current[this->axis1] : -1;
int cur2 = this->axis2 < current.size() ? current[this->axis2] : -1;
RealSize size(rect.width / axis1.groups.size(), rect.height / axis2.groups.size()); // size for a single cell RealSize size(rect.width / axis1.groups.size(), rect.height / axis2.groups.size()); // size for a single cell
double step = min(size.width, size.height) / sqrt((double)max_value) / 2.01; double step = min(size.width, size.height) / sqrt((double)max_value) / 2.01;
// Draw // Draw
if (layer == LAYER_SELECTION) { if (layer == LAYER_SELECTION) {
dc.SetPen(*wxTRANSPARENT_PEN); dc.SetPen(*wxTRANSPARENT_PEN);
Color bg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); Color bg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
int cur1 = this->axis1 < current.size() ? current[this->axis1] : -1;
int cur2 = this->axis2 < current.size() ? current[this->axis2] : -1;
if (cur1 >= 0 && cur2 >= 0) { if (cur1 >= 0 && cur2 >= 0) {
UInt value = values[cur1 * axis2.groups.size() + cur2]; UInt value = values[cur1 * axis2.groups.size() + cur2];
if (value) { if (value) {
...@@ -475,16 +498,21 @@ void ScatterGraph::draw(RotatedDC& dc, const vector<int>& current, DrawLayer lay ...@@ -475,16 +498,21 @@ void ScatterGraph::draw(RotatedDC& dc, const vector<int>& current, DrawLayer lay
Color fg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); Color fg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
dc.SetPen(fg); dc.SetPen(fg);
size_t i = 0; size_t i = 0;
double x = rect.left(); int x = 0;
FOR_EACH_CONST(g1, axis1.groups) { FOR_EACH_CONST(g1, axis1.groups) {
double y = rect.bottom() - size.height; int y = 0;
FOR_EACH_CONST(g2, axis2.groups) { FOR_EACH_CONST(g2, axis2.groups) {
UInt value = values[i++]; UInt value = values[i++];
dc.SetBrush(lerp(g1.color, g2.color, 0.5)); Color color = lerp(fg, lerp(g1.color, g2.color, 0.5 - (axis1.auto_color == AUTO_COLOR_NO ? 0.35 : 0.0) + (axis2.auto_color == AUTO_COLOR_NO ? 0.35 : 0.0)), 0.5 + (axis1.auto_color == AUTO_COLOR_NO || axis2.auto_color == AUTO_COLOR_NO ? 0.5 : 0.0));
dc.DrawCircle(RealPoint(x,y) + size/2, sqrt((double)value) * step); bool active = !(cur1 == -1 && cur2 == -1) && (x == cur1 || cur1 == -1) && (y == cur2 || cur2 == -1);
y -= size.height; dc.SetPen(active ? fg : lerp(fg,color,0.5));
dc.SetBrush(color);
double xx = rect.left() + x * size.width;
double yy = rect.bottom() - (y+1) * size.height;
dc.DrawCircle(RealPoint(xx,yy) + size/2, sqrt((double)value) * step);
++y;
} }
x += size.width; ++x;
} }
} }
} }
...@@ -533,6 +561,8 @@ void ScatterPieGraph::draw(RotatedDC& dc, const vector<int>& current, DrawLayer ...@@ -533,6 +561,8 @@ void ScatterPieGraph::draw(RotatedDC& dc, const vector<int>& current, DrawLayer
GraphAxis& axis1 = axis1_data(); // the major axis GraphAxis& axis1 = axis1_data(); // the major axis
GraphAxis& axis2 = axis2_data(); // the stacked axis GraphAxis& axis2 = axis2_data(); // the stacked axis
GraphAxis& axis3 = axis3_data(); // the pie axis GraphAxis& axis3 = axis3_data(); // the pie axis
int cur1 = this->axis1 < current.size() ? current[this->axis1] : -1;
int cur2 = this->axis2 < current.size() ? current[this->axis2] : -1;
RealSize size(rect.width / axis1.groups.size(), rect.height / axis2.groups.size()); // size for a single cell RealSize size(rect.width / axis1.groups.size(), rect.height / axis2.groups.size()); // size for a single cell
double step = min(size.width, size.height) / sqrt((double)max_value) / 2.01; double step = min(size.width, size.height) / sqrt((double)max_value) / 2.01;
// Draw pies // Draw pies
...@@ -543,15 +573,17 @@ void ScatterPieGraph::draw(RotatedDC& dc, const vector<int>& current, DrawLayer ...@@ -543,15 +573,17 @@ void ScatterPieGraph::draw(RotatedDC& dc, const vector<int>& current, DrawLayer
size_t i = x * axis2.groups.size() + y; size_t i = x * axis2.groups.size() + y;
UInt value = values[i]; UInt value = values[i];
double radius = floor(sqrt((double)value) * step * 2); double radius = floor(sqrt((double)value) * step * 2);
bool active = !(cur1 == -1 && cur2 == -1) && ((int)x == cur1 || cur1 == -1) && ((int)y == cur2 || cur2 == -1);
RealSize radius_s(radius,radius); RealSize radius_s(radius,radius);
RealPoint center(rect.left() + (x+0.5) * size.width + 0.5, rect.bottom() - (y+0.5) * size.height + 0.5); RealPoint center(rect.left() + (x+0.5) * size.width + 0.5, rect.bottom() - (y+0.5) * size.height + 0.5);
// draw pie slices // draw pie slices
double angle = 0; double angle = 0;
size_t j = 0; size_t j = 0;
FOR_EACH(g, axis3.groups) { FOR_EACH(g, axis3.groups) {
dc.SetBrush(g.color);
UInt val = values3D[i * axis3.groups.size() + j++]; UInt val = values3D[i * axis3.groups.size() + j++];
if (val > 0) { if (val > 0) {
dc.SetBrush(g.color);
dc.SetPen(active ? fg : lerp(fg,g.color,0.5));
double end_angle = angle + 2 * M_PI * (double)val / value; double end_angle = angle + 2 * M_PI * (double)val / value;
dc.DrawEllipticArc(center, radius_s, angle, end_angle); dc.DrawEllipticArc(center, radius_s, angle, end_angle);
angle = end_angle; angle = end_angle;
...@@ -604,10 +636,10 @@ void GraphStats::draw(RotatedDC& dc, int current, DrawLayer layer) const { ...@@ -604,10 +636,10 @@ void GraphStats::draw(RotatedDC& dc, int current, DrawLayer layer) const {
Color bg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); Color bg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
// draw border // draw border
dc.SetBrush(bg); dc.SetBrush(bg);
dc.SetPen(fg);
dc.DrawRectangle(RealRect(pos,size)); dc.DrawRectangle(RealRect(pos,size));
// draw items // draw items
dc.SetFont(*wxNORMAL_FONT); dc.SetFont(*wxNORMAL_FONT);
dc.SetPen(fg);
double y = pos.y + 1; double y = pos.y + 1;
FOR_EACH_CONST(v, values) { FOR_EACH_CONST(v, values) {
dc.DrawText(v.first, RealPoint(pos.x + 3, y + 2)); dc.DrawText(v.first, RealPoint(pos.x + 3, y + 2));
...@@ -643,10 +675,10 @@ void GraphLegend::draw(RotatedDC& dc, int current, DrawLayer layer) const { ...@@ -643,10 +675,10 @@ void GraphLegend::draw(RotatedDC& dc, int current, DrawLayer layer) const {
Color bg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); Color bg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
// draw border // draw border
dc.SetBrush(bg); dc.SetBrush(bg);
dc.SetPen(fg);
dc.DrawRectangle(RealRect(pos,size)); dc.DrawRectangle(RealRect(pos,size));
// draw items // draw items
dc.SetFont(*wxNORMAL_FONT); dc.SetFont(*wxNORMAL_FONT);
dc.SetPen(fg);
double y = pos.y + 1; double y = pos.y + 1;
for (int j = 0 ; j < (int)axis.groups.size() ; ++j) { for (int j = 0 ; j < (int)axis.groups.size() ; ++j) {
int i = reverse ? (int)axis.groups.size() - j - 1 : j; int i = reverse ? (int)axis.groups.size() - j - 1 : j;
...@@ -658,6 +690,7 @@ void GraphLegend::draw(RotatedDC& dc, int current, DrawLayer layer) const { ...@@ -658,6 +690,7 @@ void GraphLegend::draw(RotatedDC& dc, int current, DrawLayer layer) const {
dc.SetPen(fg); dc.SetPen(fg);
} }
dc.SetBrush(g.color); dc.SetBrush(g.color);
dc.SetPen(i == current ? fg : lerp(fg,g.color,0.5));
dc.DrawRectangle(RealRect(pos.x+3, y + 2, 26, item_size.height - 3)); dc.DrawRectangle(RealRect(pos.x+3, y + 2, 26, item_size.height - 3));
dc.DrawText(g.name, RealPoint(pos.x + 32, y + 2)); dc.DrawText(g.name, RealPoint(pos.x + 32, y + 2));
y += item_size.height; y += item_size.height;
...@@ -808,7 +841,7 @@ void GraphValueAxis::draw(RotatedDC& dc, int current, DrawLayer layer) const { ...@@ -808,7 +841,7 @@ void GraphValueAxis::draw(RotatedDC& dc, int current, DrawLayer layer) const {
// restore font/pen // restore font/pen
if (i == highlight) { if (i == highlight) {
dc.SetFont(*wxNORMAL_FONT); dc.SetFont(*wxNORMAL_FONT);
dc.SetPen(lerp(bg, fg, 0.5)); dc.SetPen(lerp(bg, fg, 0.3));
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment