At my Doodle Drawer app, I’ve played with a couple of “brushes”. The idea is to treat the connection lines differently.
shaded | sketched | fur |
Basically the difference is that the line connections are drawn closer or further away from each line based on the formula of Harmony.
The ‘shaded brush’ looks like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | @Override public void addConnections(Point nextPoint, int color, float strokeWidth) { ArrayList<Point> points = PointsList.points; for (int i = 0; i < points.size(); ++i) { Point curPoint = points.get(i); float b = curPoint.x - nextPoint.x; float a = curPoint.y - nextPoint.y; float distance = b * b + a * a; if (distance < 2000f * Config.DEVICE_DISPLAY_METRICS.density) { int alpha = 255-((int) (225f / 2000f * Config.DEVICE_DISPLAY_METRICS.density * distance)); int newColor = Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color)); LineList.connections.add(new Line(nextPoint, curPoint, newColor, strokeWidth * Config.BRUSH_PRESSURE * 0.5f)); } } } |
The sketched brush looks like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | @Override public void addConnections(Point nextPoint, int color, float strokeWidth) { ArrayList points = PointsList.points; for (int i = 0; i < points.size(); ++i) { Point curPoint = points.get(i); float b = curPoint.x - nextPoint.x; float a = curPoint.y - nextPoint.y; float distance = b * b + a * a; if (distance < 10000 * Config.DEVICE_DISPLAY_METRICS.density && Math.random() > (distance / 10000 * Config.DEVICE_DISPLAY_METRICS.density)) { int alpha = 255 - ((int) ((225f / 2000f * Config.DEVICE_DISPLAY_METRICS.density) * distance)); int newColor = Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color)); final float c = 0.2f; LineList.connections.add(new Line(new Point(nextPoint.x + (b * c), nextPoint.y + (a * c)), new Point(curPoint.x - (b * c), curPoint.y - (a * c)),newColor, strokeWidth * 0.5f * Config.BRUSH_PRESSURE)); } } } |
And the ‘fur brush’ looks like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | @Override public void addConnections(Point nextPoint, int color, float strokeWidth) { ArrayList points = PointsList.points; for (int i = 0; i < points.size(); ++i) { Point curPoint = points.get(i); float b = curPoint.x - nextPoint.x; float a = curPoint.y - nextPoint.y; float distance = b * b + a * a; if (distance < 4000f * Config.DEVICE_DISPLAY_METRICS.density && Math.random() > distance / 4000f * Config.DEVICE_DISPLAY_METRICS.density) { final float c = 0.5f; LineList.connections.add(new Line(new Point(nextPoint.x + (b * c), nextPoint.y + (a * c)), new Point(nextPoint.x - (b * c), nextPoint.y - (a * c)), color, strokeWidth * Config.BRUSH_PRESSURE * 0.5f)); } } } |
Leave a Reply