mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/shared] CurveView: add a parameter "color" to drawLabel
This commit is contained in:
@@ -242,7 +242,7 @@ void CurveView::drawGraduation(KDContext * ctx, KDRect rect, Axis axis, float gr
|
||||
ctx->fillRect(graduation, KDColorBlack);
|
||||
}
|
||||
|
||||
void CurveView::privateDrawLabel(KDContext * ctx, KDRect rect, Axis axis, float grad, const char * label, float verticalCoordinate, float horizontalCoordinate, FloatingPosition floatingLabels, bool shiftOrigin, KDCoordinate viewHeight, KDColor backgroundColor) const {
|
||||
void CurveView::privateDrawLabel(KDContext * ctx, KDRect rect, Axis axis, float grad, const char * label, float verticalCoordinate, float horizontalCoordinate, KDColor color, FloatingPosition floatingLabels, bool shiftOrigin, KDCoordinate viewHeight, KDColor backgroundColor) const {
|
||||
KDCoordinate labelPosition = std::round(floatToPixel(axis, grad));
|
||||
KDSize textSize = k_font->stringSize(label);
|
||||
float xPosition = 0.0f;
|
||||
@@ -283,14 +283,14 @@ void CurveView::privateDrawLabel(KDContext * ctx, KDRect rect, Axis axis, float
|
||||
}
|
||||
KDPoint origin = KDPoint(xPosition, yPosition);
|
||||
if (rect.intersects(KDRect(origin, textSize))) {
|
||||
ctx->drawString(label, origin, k_font, KDColorBlack, backgroundColor);
|
||||
ctx->drawString(label, origin, k_font, color, backgroundColor);
|
||||
}
|
||||
}
|
||||
|
||||
void CurveView::drawLabel(KDContext * ctx, KDRect rect, Axis axis, float position, const char * label) const {
|
||||
void CurveView::drawLabel(KDContext * ctx, KDRect rect, Axis axis, float position, const char * label, KDColor color) const {
|
||||
float verticalCoordinate = std::round(floatToPixel(Axis::Vertical, 0.0f));
|
||||
float horizontalCoordinate = std::round(floatToPixel(Axis::Horizontal, 0.0f));
|
||||
privateDrawLabel(ctx, rect, axis, position, label, verticalCoordinate, horizontalCoordinate);
|
||||
privateDrawLabel(ctx, rect, axis, position, label, verticalCoordinate, horizontalCoordinate, color);
|
||||
}
|
||||
|
||||
void CurveView::drawLabelsAndGraduations(KDContext * ctx, KDRect rect, Axis axis, bool shiftOrigin, bool graduationOnly, bool fixCoordinate, KDCoordinate fixedCoordinate, KDColor backgroundColor) const {
|
||||
@@ -362,7 +362,7 @@ void CurveView::drawLabelsAndGraduations(KDContext * ctx, KDRect rect, Axis axis
|
||||
|
||||
// Draw the labels
|
||||
for (int i = minDrawnLabel; i < maxDrawnLabel; i++) {
|
||||
privateDrawLabel(ctx, rect, axis, labelValueAtIndex(axis, i), label(axis, i), verticalCoordinate, horizontalCoordinate, floatingLabels, shiftOrigin, viewHeight, backgroundColor);
|
||||
privateDrawLabel(ctx, rect, axis, labelValueAtIndex(axis, i), label(axis, i), verticalCoordinate, horizontalCoordinate, KDColorBlack, floatingLabels, shiftOrigin, viewHeight, backgroundColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ protected:
|
||||
bool fillBar, KDColor defaultColor, KDColor highlightColor, float highlightLowerBound = INFINITY, float highlightUpperBound = -INFINITY) const;
|
||||
void computeLabels(Axis axis);
|
||||
void simpleDrawBothAxesLabels(KDContext * ctx, KDRect rect) const;
|
||||
void drawLabel(KDContext * ctx, KDRect rect, Axis axis, float position, const char * label) const;
|
||||
void drawLabel(KDContext * ctx, KDRect rect, Axis axis, float position, const char * label, KDColor color) const;
|
||||
void drawLabelsAndGraduations(KDContext * ctx, KDRect rect, Axis axis, bool shiftOrigin, bool graduationOnly = false, bool fixCoordinate = false, KDCoordinate fixedCoordinate = 0, KDColor backgroundColor = KDColorWhite) const;
|
||||
View * m_bannerView;
|
||||
CurveViewCursor * m_curveViewCursor;
|
||||
@@ -87,7 +87,7 @@ private:
|
||||
Min,
|
||||
Max
|
||||
};
|
||||
void privateDrawLabel(KDContext * ctx, KDRect rect, Axis axis, float grad, const char * label, float verticalCoordinate, float horizontalCoordinate, FloatingPosition floatingLabels = FloatingPosition::None, bool shiftOrigin = false, KDCoordinate viewHeight = 0, KDColor backgroundColor = KDColorWhite) const;
|
||||
void privateDrawLabel(KDContext * ctx, KDRect rect, Axis axis, float grad, const char * label, float verticalCoordinate, float horizontalCoordinate, KDColor color, FloatingPosition floatingLabels = FloatingPosition::None, bool shiftOrigin = false, KDCoordinate viewHeight = 0, KDColor backgroundColor = KDColorWhite) const;
|
||||
void drawGridLines(KDContext * ctx, KDRect rect, Axis axis, float step, KDColor boldColor, KDColor lightColor) const;
|
||||
/* The window bounds are deduced from the model bounds but also take into
|
||||
account a margin (computed with k_marginFactor) */
|
||||
|
||||
Reference in New Issue
Block a user