Krotos Modules 3
Loading...
Searching...
No Matches
krotosDrawingHelper.cpp
Go to the documentation of this file.
2
3namespace krotos
4{
5 void DrawingHelper::drawBackgroundGrid(Graphics& g, int boxWidth, const Rectangle<int>& bounds, float opacity)
6 {
7 ColourGradient cg = ColourGradient::vertical(KColours::topGridColour.withAlpha(opacity),
8 KColours::bottomGridColour.withAlpha(opacity), bounds);
9 g.setGradientFill(cg);
10 g.fillRect(bounds);
11
12 g.setColour(KColours::gridColour.withAlpha(0.5f));
13 for (int x = bounds.getX(); x < bounds.getRight(); x += boxWidth)
14 {
15 g.drawVerticalLine(x, float(bounds.getY()), float(bounds.getBottom()));
16 }
17 for (int y = bounds.getY(); y < bounds.getBottom(); y += boxWidth)
18 {
19 g.drawHorizontalLine(y, float(bounds.getX()), float(bounds.getRight()));
20 }
21 }
22 void DrawingHelper::drawBackgroundGridNoBackground(Graphics& g, int boxWidth, const Rectangle<int>& bounds)
23 {
24 for (int x = bounds.getX(); x < bounds.getRight(); x += boxWidth)
25 {
26 g.drawVerticalLine(x, float(bounds.getY()), float(bounds.getBottom()));
27 }
28 for (int y = bounds.getY(); y < bounds.getBottom(); y += boxWidth)
29 {
30 g.drawHorizontalLine(y, float(bounds.getX()), float(bounds.getRight()));
31 }
32 }
33
34 void DrawingHelper::drawBackgroundHorizontalLines(Graphics& g, int betweenLinesWidth, const Rectangle<int>& bounds)
35 {
36 const int lineHeight(1);
37 for (int y = bounds.getY(); y < bounds.getBottom(); y += betweenLinesWidth + lineHeight)
38 {
39 g.drawHorizontalLine(y, float(bounds.getX()), float(bounds.getRight()));
40 }
41 }
42} // namespace krotos
static void drawBackgroundGrid(Graphics &g, int boxWidth, const Rectangle< int > &bounds, float opacity)
Definition krotosDrawingHelper.cpp:5
static void drawBackgroundGridNoBackground(Graphics &g, int boxWidth, const Rectangle< int > &bounds)
Definition krotosDrawingHelper.cpp:22
static void drawBackgroundHorizontalLines(Graphics &g, int betweenLinesWidth, const Rectangle< int > &bounds)
Definition krotosDrawingHelper.cpp:34
const Colour topGridColour
Definition Krotos_Colours.h:14
const Colour gridColour
Definition Krotos_Colours.h:16
const Colour bottomGridColour
Definition Krotos_Colours.h:15
Definition AirAbsorptionFilter.cpp:2