public void destroyLineRenderer() { if (lrc != null) { lrc.selfDestroy(); lrc = null; } }
void finishDrawing() { Color32[] colors = canvas.fetchColors(); bool useMask = PropertiesSingleton.instance.drawWithinRegion; if (lineRendererController == null) { return; } List <IntVector2> points = lineRendererController.getPointArray(); if (interpolatedPath == null) { interpolatedPath = new List <IntVector2>(); } else { interpolatedPath.Clear(); } InterpolateContext ic = new InterpolateContext(interpolateStrategy); ic.interpolate(points, interpolatedPath); TextureUtil.generateTexturePath(tool, PropertiesSingleton.instance.colorProperties.activeColor, interpolatedPath, colors, canvasConfig.canvasSize.x, canvasConfig.canvasSize.y); if (useMask) { bool[,] maskColors = TextureUtil.floodFillLineGetRegion(firstPoint, canvas.actualColors, canvas.persistentLayer, canvasConfig.canvasSize.x, canvasConfig.canvasSize.y); int tCounter = 0; for (int y = 0; y < canvasConfig.canvasSize.y; y++) { for (int x = 0; x < canvasConfig.canvasSize.x; x++) { if (!maskColors[x, y]) { colors[tCounter].a = 0; } tCounter++; } } } if (lineRendererController != null) { lineRendererController.selfDestroy(); } canvas.applyColors(colors); }