Tweak DiskUsage pie view colors and drawing
* Use colors from http://haiku-os.org/files/downloads/2007-03-20_haiku-color-palette.png * The pie view used a simple multiplication to lighten the colors, leading to overflows. Use tint_color instead * The outline of each pie slice was drawn with lines, which did not align perfectly. Use StrokeArc with a slightly bigger pen size than the colored area instead. Screenshot of the result: http://pulkomandy.tk/drop/diskusage.png/
This commit is contained in:
@@ -18,14 +18,11 @@ const rgb_color RGB_WIN = { 0xDE, 0xDB, 0xDE, 0xFF };
|
|||||||
const rgb_color RGB_PIE_OL = { 0x80, 0x80, 0x80, 0xFF };
|
const rgb_color RGB_PIE_OL = { 0x80, 0x80, 0x80, 0xFF };
|
||||||
const rgb_color RGB_PIE_BG = { 0xFF, 0xFF, 0xFF, 0xFF };
|
const rgb_color RGB_PIE_BG = { 0xFF, 0xFF, 0xFF, 0xFF };
|
||||||
const rgb_color RGB_PIE_MT = { 0xA0, 0xA0, 0xA0, 0xFF };
|
const rgb_color RGB_PIE_MT = { 0xA0, 0xA0, 0xA0, 0xFF };
|
||||||
const rgb_color RGB_PIE_1 = { 0x00, 0x00, 0xb6, 0xFF };
|
|
||||||
const rgb_color RGB_PIE_2 = { 0x00, 0x00, 0x68, 0xFF };
|
|
||||||
const rgb_color RGB_PIE_3 = { 0xcf, 0x00, 0x00, 0xFF };
|
|
||||||
const rgb_color RGB_PIE_4 = { 0xaf, 0x63, 0xb1, 0xFF };
|
|
||||||
|
|
||||||
const int kBasePieColorCount = 4;
|
const int kBasePieColorCount = 4;
|
||||||
const rgb_color kBasePieColor[kBasePieColorCount]
|
const rgb_color kBasePieColor[kBasePieColorCount]
|
||||||
= { RGB_PIE_1, RGB_PIE_2, RGB_PIE_3, RGB_PIE_4 };
|
= { { 0x33, 0x66, 0x98, 0xFF }, { 0x43, 0xAE, 0x39, 0xFF },
|
||||||
|
{ 0xFF, 0xD3, 0x00, 0xFF }, { 0xFF, 0x76, 0x00, 0xFF } };
|
||||||
|
|
||||||
const rgb_color kWindowColor = ui_color(B_PANEL_BACKGROUND_COLOR);
|
const rgb_color kWindowColor = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||||
const rgb_color kOutlineColor = RGB_PIE_OL;
|
const rgb_color kOutlineColor = RGB_PIE_OL;
|
||||||
@@ -53,7 +50,6 @@ const float kPieRingSize = 20.0;
|
|||||||
const float kPieInnerMargin = 10.0;
|
const float kPieInnerMargin = 10.0;
|
||||||
const float kPieOuterMargin = 10.0;
|
const float kPieOuterMargin = 10.0;
|
||||||
const float kMinSegmentSpan = 2.0;
|
const float kMinSegmentSpan = 2.0;
|
||||||
const int kLightenFactor = 0x12;
|
|
||||||
const float kDragThreshold = 5.0;
|
const float kDragThreshold = 5.0;
|
||||||
|
|
||||||
extern entry_ref helpFileRef;
|
extern entry_ref helpFileRef;
|
||||||
|
|||||||
@@ -534,38 +534,20 @@ PieView::_DrawDirectory(BRect b, FileInfo* info, float parentSpan,
|
|||||||
|
|
||||||
mySpan = parentSpan * (float)info->size / parentSize;
|
mySpan = parentSpan * (float)info->size / parentSize;
|
||||||
if (mySpan >= kMinSegmentSpan) {
|
if (mySpan >= kMinSegmentSpan) {
|
||||||
rgb_color color = kBasePieColor[colorIdx];
|
const float tint = 1.4f - level * 0.08f;
|
||||||
color.red += kLightenFactor * level;
|
|
||||||
color.green += kLightenFactor * level;
|
|
||||||
color.blue += kLightenFactor * level;
|
|
||||||
SetHighColor(color);
|
|
||||||
SetPenSize(kPieRingSize);
|
|
||||||
float radius = kPieCenterSize + level * kPieRingSize
|
float radius = kPieCenterSize + level * kPieRingSize
|
||||||
- kPieRingSize / 2.0;
|
- kPieRingSize / 2.0;
|
||||||
StrokeArc(BPoint(cx, cy), radius, radius, beginAngle, mySpan);
|
|
||||||
|
|
||||||
SetHighColor(kOutlineColor);
|
// Draw the grey border
|
||||||
SetPenSize(0.0);
|
SetHighColor(tint_color(kOutlineColor, tint));
|
||||||
float segBeginRadius = kPieCenterSize + (level - 1)
|
SetPenSize(kPieRingSize + 1.5f);
|
||||||
* kPieRingSize + 0.5;
|
StrokeArc(BPoint(cx, cy), radius, radius,
|
||||||
float segLength = kPieRingSize - 0.5;
|
beginAngle - 0.001f * radius, mySpan + 0.002f * radius);
|
||||||
float rad = deg2rad(beginAngle);
|
|
||||||
float bx = cx + segBeginRadius * cos(rad);
|
|
||||||
float by = cy - segBeginRadius * sin(rad);
|
|
||||||
float ex = bx + segLength * cos(rad);
|
|
||||||
float ey = by - segLength * sin(rad);
|
|
||||||
StrokeLine(BPoint(bx, by), BPoint(ex, ey));
|
|
||||||
|
|
||||||
rad = deg2rad(beginAngle + mySpan);
|
// Draw the colored area
|
||||||
bx = cx + segBeginRadius * cos(rad);
|
rgb_color color = tint_color(kBasePieColor[colorIdx], tint);
|
||||||
by = cy - segBeginRadius * sin(rad);
|
SetHighColor(color);
|
||||||
ex = bx + segLength * cos(rad);
|
SetPenSize(kPieRingSize);
|
||||||
ey = by - segLength * sin(rad);
|
|
||||||
StrokeLine(BPoint(bx, by), BPoint(ex, ey));
|
|
||||||
|
|
||||||
SetPenSize(0.0);
|
|
||||||
SetHighColor(kOutlineColor);
|
|
||||||
radius += kPieRingSize / 2.0;
|
|
||||||
StrokeArc(BPoint(cx, cy), radius, radius, beginAngle, mySpan);
|
StrokeArc(BPoint(cx, cy), radius, radius, beginAngle, mySpan);
|
||||||
|
|
||||||
// Record the segment for use during MouseMoved().
|
// Record the segment for use during MouseMoved().
|
||||||
|
|||||||
Reference in New Issue
Block a user