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

Function xs_poco_fillPattern

modules/commodetto/commodettoPocoCore.c:877–917  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

875}
876
877void xs_poco_fillPattern(xsMachine *the)
878{
879 Poco poco = xsmcGetHostDataPoco(xsThis);
880 PocoBitmapRecord bits;
881 PocoCoordinate x, y;
882 PocoDimension w, h, sx, sy, sw, sh;
883 CommodettoBitmap cb;
884 int argc = xsmcArgc;
885
886 cb = xsmcGetHostChunk(xsArg(0));
887 bits.width = cb->w;
888 bits.height = cb->h;
889 bits.format = cb->format;
890#if COMMODETTO_BITMAP_ID
891 bits.id = cb->id;
892 bits.byteLength = 0;
893#endif
894 bits.pixels = pocoGetBitmapPixels(the, poco, cb, 0);
895
896 x = (PocoCoordinate)xsmcToInteger(xsArg(1)) + poco->xOrigin;
897 y = (PocoCoordinate)xsmcToInteger(xsArg(2)) + poco->yOrigin;
898 w = (PocoDimension)xsmcToInteger(xsArg(3));
899 h = (PocoDimension)xsmcToInteger(xsArg(4));
900 if (argc > 5) {
901 sx = (PocoCoordinate)xsmcToInteger(xsArg(5));
902 sy = (PocoCoordinate)xsmcToInteger(xsArg(6));
903 sw = (PocoDimension)xsmcToInteger(xsArg(7));
904 sh = (PocoDimension)xsmcToInteger(xsArg(8));
905
906#if (0 == kPocoRotation) || (180 == kPocoRotation)
907 if ((sx >= bits.width) || (sy >= bits.height) || ((sx + sw) > bits.width) || ((sy + sh) > bits.height))
908#else
909 if ((sx >= bits.height) || (sy >= bits.width) || ((sx + sw) > bits.height) || ((sy + sh) > bits.width))
910#endif
911 xsRangeError("invalid src");
912
913 PocoBitmapPattern(poco, &bits, x, y, w, h, sx, sy, sw, sh);
914 }
915 else
916 PocoBitmapPattern(poco, &bits, x, y, w, h, 0, 0, bits.width, bits.height);
917}
918
919void xs_poco_drawFrame(xsMachine *the)
920{

Callers

nothing calls this directly

Calls 2

pocoGetBitmapPixelsFunction · 0.85
PocoBitmapPatternFunction · 0.85

Tested by

no test coverage detected