public void startToConvertSprite() { xMin -= 64; yMin -= 64; xMax += 64; yMax += 64; captureViewport = new Viewport(); captureViewport.Size = new Vector2(xMax - xMin, yMax - yMin); captureViewport.RenderTargetUpdateMode = Viewport.UpdateMode.Always; captureViewport.RenderTargetClearMode = Viewport.ClearMode.Always; captureViewport.TransparentBg = true; captureViewport.Usage = Viewport.UsageEnum.Usage2d; GetTree().CurrentScene.AddChild(captureViewport); cloneDrawObject = new drawObject(); cloneDrawObject.pointList = pointList; cloneDrawObject.brushColor = brushColor; cloneDrawObject.brushIndexList = brushIndexList; cloneDrawObject.drawMode = drawMode; cloneDrawObject.Position -= new Vector2(xMin, yMin); captureViewport.AddChild(cloneDrawObject); cloneDrawObject.Update(); cloneDrawObject.Connect("first_draw_ended", this, "finalToConvertSprite"); //GetTree().CreateTimer(0.2f).Connect("timeout",this,"finalToConvertSprite"); }
public void endDraw() { if (lastDrawObject == null) { return; } lastDrawObject.Update(); lastDrawObject.drawEnded = true; lastDrawObject.startToConvertSprite(); lastDrawObject.Connect("converted_sprite", this, "isDrawObjectConvertedSprite"); lastDrawObject = null; mousePosTemp.Clear(); isChangedDrawings = true; //This state show bad performance when user draw fast emp.Clear(//); //saveLastDrawings(); }