MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / PiuPort_drawString

Function PiuPort_drawString

modules/piu/All/piuPort.c:225–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223}
224
225void PiuPort_drawString(xsMachine* the)
226{
227 xsIntegerValue c = xsToInteger(xsArgc);
228 PiuPort* self = PIU(Port, xsThis);
229 PiuView* view = (*self)->view;
230 xsSlot* string;
231 PiuStyle* style;
232 PiuColorRecord color;
233 PiuCoordinate x, y;
234 PiuDimension w, sw;
235 if (!view) xsUnknownError("out of sequence");
236 style = PIU(Style, xsArg(1));
237 if ((*style)->font == NULL)
238 PiuStyleLookupFont(style);
239 PiuColorDictionary(the, &xsArg(2), &color);
240 string = PiuString(xsArg(0));
241 x = xsToPiuCoordinate(xsArg(3));
242 y = xsToPiuCoordinate(xsArg(4));
243 w = (c > 5) ? xsToPiuDimension(xsArg(5)) : 0;
244 sw = w ? PiuFontGetWidth((*style)->font, string, 0, -1) : 0;
245 PiuViewPushColor(view, &color);
246 PiuViewDrawString(view, string, 0, -1, (*style)->font, x, y, w, sw);
247 PiuViewPopColor(view);
248}
249
250void PiuPort_drawStyle(xsMachine* the)
251{

Callers

nothing calls this directly

Calls 6

PiuColorDictionaryFunction · 0.85
PiuStyleLookupFontFunction · 0.50
PiuFontGetWidthFunction · 0.50
PiuViewPushColorFunction · 0.50
PiuViewDrawStringFunction · 0.50
PiuViewPopColorFunction · 0.50

Tested by

no test coverage detected