void onMouseOverWithButtonDone(IntVector2 obj) { Profiler.BeginSample("onMouseOverWithButtonDone"); Profiler.BeginSample("init start"); points.Add(obj); InterpolateContext ic = new InterpolateContext(new LinearInterpolationStrategy()); Profiler.EndSample(); Profiler.BeginSample("interpolation"); if (interpolatedPath == null) { interpolatedPath = new List <IntVector2>(); } else { interpolatedPath.Clear(); } ic.interpolate(points, interpolatedPath); Profiler.EndSample(); Profiler.BeginSample("fetch colors"); Color32[] workingColors = canvas.fetchColors(); Profiler.EndSample(); Profiler.BeginSample("apply points with cache"); TextureUtil.generateTexturePath(canvasTool, ColorUtil.getRandomColor(), interpolatedPath, workingColors, canvasConfig.canvasSize.x, canvasConfig.canvasSize.y); Profiler.EndSample(); Profiler.BeginSample("update back layer"); Debug.Log("change color and use aply method"); //canvas.applyColors(workingColors, ColorUtil.getRandomColor()); Profiler.EndSample(); Profiler.EndSample(); }
void onMouseOverWithButtonDone(IntVector2 obj) { Profiler.BeginSample("onMouseOverWithButtonDone"); Profiler.BeginSample("init start"); points.Add(obj); InterpolateContext ic = new InterpolateContext (new LinearInterpolationStrategy()); Profiler.EndSample(); Profiler.BeginSample("interpolation"); if (interpolatedPath==null) interpolatedPath= new List<IntVector2>(); else interpolatedPath.Clear(); ic.interpolate(points, interpolatedPath); Profiler.EndSample(); Profiler.BeginSample("fetch colors"); Color32[] workingColors= canvas.fetchColors(); Profiler.EndSample(); Profiler.BeginSample("apply points with cache"); TextureUtil.generateTexturePath(canvasTool, ColorUtil.getRandomColor(),interpolatedPath,workingColors,canvasConfig.canvasSize.x, canvasConfig.canvasSize.y); Profiler.EndSample(); Profiler.BeginSample("update back layer"); Debug.Log("change color and use aply method"); //canvas.applyColors(workingColors, ColorUtil.getRandomColor()); Profiler.EndSample(); Profiler.EndSample(); }
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); }
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); }