MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / paint

Method paint

Source/UIComponents/CtrlrPanel/CtrlrPanelCanvas.cpp:53–120  ·  view source on GitHub ↗

==============================================================================

Source from the content-addressed store, hash-verified

51
52//==============================================================================
53void CtrlrPanelCanvas::paint (Graphics& g)
54{
55 if (paintCbk && !paintCbk.wasObjectDeleted())
56 {
57 if (paintCbk->isValid())
58 {
59 owner.getOwner().getCtrlrLuaManager().getMethodManager().call (paintCbk, this, g);
60
61 return;
62 }
63 }
64
65 if ((int)getOwner().getProperty (Ids::uiPanelBackgroundGradientType) == 0)
66 {
67 g.fillAll(VAR2COLOUR(getOwner().getProperty(Ids::uiPanelBackgroundColour)));
68 }
69 else
70 {
71 gradientFromProperty(g, getBounds(), getOwner().getObjectTree(), Ids::uiPanelBackgroundGradientType, Ids::uiPanelBackgroundColour1, Ids::uiPanelBackgroundColour2);
72 g.fillAll();
73 }
74
75 Colour c = VAR2COLOUR (getOwner().getProperty (Ids::uiPanelBackgroundColour1, "ffffffff"));
76
77 if (ctrlrPanelBackgroundImage.isValid())
78 {
79 if ((int)getOwner().getProperty (Ids::uiPanelImageLayout) == 8192)
80 {
81 g.setTiledImageFill (ctrlrPanelBackgroundImage, 0, 0, (float)getOwner().getProperty (Ids::uiPanelImageAlpha)/255.0f);
82 g.fillAll();
83 }
84 else
85 {
86 g.drawImageWithin (ctrlrPanelBackgroundImage,
87 0,
88 0,
89 getWidth(),
90 getHeight(),
91 RectanglePlacement((int)getOwner().getProperty (Ids::uiPanelImageLayout)));
92 }
93 }
94 if (getOwner().getProperty (Ids::uiPanelEditMode))
95 {
96 const int snapSize = (int)getOwner().getProperty (Ids::uiPanelSnapSize, 8);
97 if (snapSize > 0)
98 {
99 backgroundFill = Image (Image::ARGB, snapSize, snapSize, true);
100 Graphics g1(backgroundFill);
101 Colour col2 = c.contrasting();
102
103 if (snapSize > 2)
104 {
105 g1.setColour (col2.withAlpha (0.1f));
106 g1.drawRect (0, 0, snapSize + 1, snapSize + 1);
107 }
108
109 g1.setColour (col2.withAlpha (0.35f));
110 //g1.setPixel (0, 0);

Callers

nothing calls this directly

Calls 15

gradientFromPropertyFunction · 0.85
RectanglePlacementFunction · 0.85
ImageClass · 0.85
fillAllMethod · 0.80
setTiledImageFillMethod · 0.80
drawImageWithinMethod · 0.80
contrastingMethod · 0.80
withAlphaMethod · 0.80
getBoundsFunction · 0.50
getWidthFunction · 0.50
getHeightFunction · 0.50
isValidMethod · 0.45

Tested by

no test coverage detected