@@ -30,6 +30,18 @@ namespace
3030
3131 static const COLORREF s_defaultLabelTextColor = 0x00FFFFFF ;
3232 static const COLORREF s_defaultErrorTextColor = 0x004040FF ;
33+ static const COLORREF s_defaultLabelBackColor = 0x00805050 ;
34+ }
35+
36+
37+ DrawableObjectAndValues::DrawableObjectAndValues ()
38+ : labelRect_{},
39+ objectRect_{}, // Object rectangle in post-transform canvas coordinates. Best rounded to whole pixel.
40+ layoutBounds_{},
41+ contentBounds_{},
42+ origin_{},
43+ flags_{FlagsSelected}
44+ {
3345}
3446
3547
@@ -158,7 +170,8 @@ void DrawableObjectAndValues::Draw(
158170 SetWorldTransform (currentHdc, &finalTransform.gdi );
159171 HFONT previousFont = SelectFont (currentHdc, labelFont);
160172 SetTextColor (currentHdc, s_defaultErrorTextColor);
161- SetBkMode (currentHdc, TRANSPARENT);
173+ SetBkMode (currentHdc, OPAQUE);
174+ SetBkColor (currentHdc, s_defaultLabelBackColor);
162175 DrawText (currentHdc, ToWChar (errorString.c_str ()), int (errorString.size ()), &errorRect, DT_NOCLIP | DT_NOPREFIX);
163176 SelectFont (currentHdc, previousFont);
164177 SetWorldTransform (currentHdc, &DrawableObject::identityTransform.gdi );
@@ -204,29 +217,21 @@ void DrawableObjectAndValues::Draw(
204217 {
205218 HFONT previousFont = SelectFont (hdc, labelFont);
206219 SetTextColor (hdc, s_defaultLabelTextColor);
207- SetBkMode (hdc, TRANSPARENT);
220+ if (objectAndValues.flags_ & DrawableObjectAndValues::FlagsSelected)
221+ {
222+ SetBkMode (hdc, OPAQUE);
223+ SetBkColor (hdc, s_defaultLabelBackColor);
224+ }
225+ else
226+ {
227+ SetBkMode (hdc, TRANSPARENT);
228+ }
208229 DrawText (hdc, ToWChar (objectAndValues.label_ .data ()), int (objectAndValues.label_ .size ()), &objectAndValues.labelRect_ , DT_NOCLIP | DT_NOPREFIX);
209230 SelectFont (hdc, previousFont);
210231 }
211232 }
212233 SetWorldTransform (hdc, &DrawableObject::identityTransform.gdi );
213234 drawingCanvas.SwitchRenderingAPI (DrawingCanvas::CurrentRenderingApiAny);
214-
215- #if 0 // todo::: delete hack
216- DrawingCanvas::RawPixels rawPixels = drawingCanvas.GetRawPixels();
217- std::vector<Edge> edges = {{0,1},{1,2},{2,3},{3,4},{4,5},{5,6},{6,7},{7,0}, {8,9},{9,10},{10,11},{11,8}, {12,13},{13,14},{14,15},{15,12}};
218- std::vector<PointI> points = {{100,100},{150,0},{250,150},{250,0},{300,100},{250,200},{150,50},{150,200}, {400,150},{600,200},{350,350},{300,250}, {400,200},{450,250},{400,275},{350,250}};
219- FillPolyline(rawPixels, canvasTransform, points, IN OUT edges, 0xFFE080C0);
220- //DrawLineTransformed(
221- // rawPixels,
222- // canvasTransform,
223- // 100,
224- // 100,
225- // 100,
226- // 200,
227- // 0xFFE080C0
228- // );
229- #endif
230235}
231236
232237
0 commit comments