public void setBrushColor(MTColor color) { this.brushColor = color; if (this.drawShape != null) { drawShape.setFillColor(color); drawShape.setStrokeColor(color); } }
public void drawBrush(int steps, Vector3D whatToAdd) { int i = 0; do { i++; cPos.addLocal(whatToAdd); // Draw new brush into FBO at correct position Vector3D diff = cPos.getSubtracted(drawLine.getCenterPointLocal()); drawApp.pushMatrix(); drawApp.translate(diff.x, diff.y); // Draw brush drawLine.setStrokeColor(lineColor); drawLine.setFillColor(lineColor); drawLine.drawComponent(drawApp.g); drawApp.popMatrix(); } while (i < steps); }
/** Private method, handle a new fiducial */ private void started() { AbstractShape roundingcircle = new MTEllipse(app, new Vector3D(event.getPosition()), 180, 180, 100); roundingcircle.setNoFill(false); float r = ToolsMath.getRandom(20, 255); float g = ToolsMath.getRandom(20, 255); float b = ToolsMath.getRandom(20, 255); roundingcircle.setFillColor(new MTColor(r, g, b, 200)); roundingcircle.setNoStroke(false); roundingcircle.setStrokeWeight(1); roundingcircle.setStrokeColor(new MTColor(r, g, b, 200)); roundingcircle.unregisterAllInputProcessors(); AbstractShape component = new MTEllipse(app, new Vector3D(event.getPosition()), 20, 20, 20); component.setNoFill(false); float r1 = ToolsMath.getRandom(20, 255); float g1 = ToolsMath.getRandom(20, 255); float b1 = ToolsMath.getRandom(20, 255); component.setFillColor(new MTColor(r1, g1, b1, 200)); component.setNoStroke(false); component.setStrokeWeight(1); component.setStrokeColor(new MTColor(r1, g1, b1, 200)); component.unregisterAllInputProcessors(); // Dont process input/gestures on this component roundingcircle.addChild(component); MTColor white = new MTColor(255, 255, 255); IFont fontArial = FontManager.getInstance().createFont(app, "arial.ttf", 50, white); MTTextArea text = new MTTextArea(app, fontArial); text.setFillColor(new MTColor(0, 0, 0, 0)); text.setStrokeColor(new MTColor(0, 0, 0, 0)); text.unregisterAllInputProcessors(); roundingcircle.addChild(text); text.setPositionRelativeToParent( new Vector3D(event.getPosition().x, event.getPosition().y - 120)); roundingcircle.setUserData("angle", event.getAngle()); MTKeyboard keys = KeyboardPool.getInstance(app).getKeyboard(); roundingcircle.addChild(keys); keys.setPositionRelativeToParent( new Vector3D(event.getPosition().x, event.getPosition().y + 150)); keys.setUserData("fiducialID", EventID); text.setExpandDirection(ExpandDirection.UP); text.unregisterAllInputProcessors(); /* * Need to find a way to keep the text centred at all times. */ // text.setEnableCaret(true); keys.addTextInputListener(text); keys.addInputListener(text); FiducialRegistry.getInstance().putFiducialCompoent(EventID, roundingcircle); String searchTerm = "Doctor Who"; TwitterSearch twsearch = new TwitterSearch(); twsearch.search(searchTerm); canvas.addChild(roundingcircle); }