Iridescence 1.00
Embedded Graphic Framework
Loading...
Searching...
No Matches
ds_gauge_arc.h
1/* Copyright (C) 2017 - 2024, Thornwave Labs Inc - All Rights Reserved.
2 * Unauthorized copying of this file, via any medium is strictly prohibited.
3 * Proprietary and confidential.
4 * Written by Razvan Turiac <razvan.turiac@thornwave.com>
5*/
6
7#ifndef _DS_GAUGE_ARC_H
8#define _DS_GAUGE_ARC_H
9
10
11#include <ds_view.h>
12#include <ds_gauge_base.h>
13#include <ds_value_base.h>
14
15
16
20class DsGaugeArc: public DsView, public DsGaugeBase, public DsValueBase
21{
22public:
26 enum Style: uint32_t
27 {
30 STYLE_CURSOR_WEDGE = (1 << 1),
31 };
32
33
45 DsGaugeArc(DsView* parent, const DsPoint &pos, const DsSize &size, float track_width, float start_angle, float end_angle, uint32_t style = STYLE_DEFAULT);
46
47
55
56
64
65
72 DsGaugeArc& setRangeFormat(const char* format);
73
74
81 DsGaugeArc& setRangeOffset(int16_t offset);
82
83
84private:
85 Style mStyle;
86
87 const ds_bitmap_font_t* mRangeFont;
88 const char* mRangeFormat;
89 DsColor mRangeColor;
90
91 uint16_t mMarginSize;
92 DsColor mCursorColor;
93
94 DsFSize mTrackOutsideRadius;
95 DsFSize mTrackInsideRadius;
96
97 float mTrackAngleStart;
98 float mTrackAngleEnd;
99 float mTrackWidth;
100
101 DsEllipse mEllipse;
102
103 float mCursorAngle;
104 DsFPoint mCursorPos[4];
105
106 DsPoint mMinRangeTextPos;
107 DsPoint mMaxRangeTextPos;
108 DsRect mValueAlignmentRegion;
109 int16_t mRangeOffset;
110
111 float getAngle(float value);
112
113 float onValueChange(float value) override final;
114 void onSizeChange(void) override final;
115 void onPaint(DsRenderer &renderer) override final;
116};
117
118
119#endif
DsColor is a class that represents a 4 channel color (Alpha, Red, Green, Blue).
Definition ds_color.h:53
DsEllipse is a class that represents a 2D ellipse (Xc, Yc, Rx, Ry)
Definition ds_geometry.h:2636
DsFPoint is a class that represents the X and Y 2D coordinates of a point as floating point numbers.
Definition ds_geometry.h:397
DsFSize is class that represents the 2D size of a graphic object (width, height) as floating point va...
Definition ds_geometry.h:1110
DsGaugeArc is a class that implements an arc style gauge.
Definition ds_gauge_arc.h:21
DsGaugeArc(DsView *parent, const DsPoint &pos, const DsSize &size, float track_width, float start_angle, float end_angle, uint32_t style=STYLE_DEFAULT)
Creates a DsGaugeArc object.
DsGaugeArc & setRangeColor(DsColor color)
Sets the range text color.
DsGaugeArc & setRangeOffset(int16_t offset)
Sets the horizontal range offset in pixels.
DsGaugeArc & setRangeFont(const ds_bitmap_font_t *font)
Sets the font used to render the range.
Style
Arc gauge style.
Definition ds_gauge_arc.h:27
@ STYLE_DEFAULT
Default arc gauge style.
Definition ds_gauge_arc.h:28
@ STYLE_CURSOR_WEDGE
The cursor is visible and has a wedge shape.
Definition ds_gauge_arc.h:30
@ STYLE_BIDIRECTIONAL
Arc gauge is bidirectional, it can display positive and negative values.
Definition ds_gauge_arc.h:29
DsGaugeArc & setRangeFormat(const char *format)
Sets the printf() style format string used to print the range value.
DsGaugeBase is a base class for all gauge views.
Definition ds_gauge_base.h:22
DsPoint is a class that represents the X and Y 2D coordinates of a point as integer numbers.
Definition ds_geometry.h:24
DsRect is a class that represents a 2D rectangle (X, Y, W, H)
Definition ds_geometry.h:1507
DsRenderer is a class that implements all the drawing operations.
Definition ds_renderer.h:42
DsSize is class that represents the 2D size of a graphic object (width, height) as integer values.
Definition ds_geometry.h:780
DsValueBase is a base class that contains a float value.
Definition ds_value_base.h:19
DsView is a base class that represents any view on the screen.
Definition ds_view.h:40
Definition ds_font.h:45