void Graphics::strokePath (const Path& path, const PathStrokeType& strokeType, const AffineTransform& transform) const { Path stroke; strokeType.createStrokedPath (stroke, path, transform, context.getScaleFactor()); fillPath (stroke); }
void resized() { float x1, y1, x2, y2; getPoints (x1, y1, x2, y2); lastInputX = x1; lastInputY = y1; lastOutputX = x2; lastOutputY = y2; x1 -= getX(); y1 -= getY(); x2 -= getX(); y2 -= getY(); linePath.clear(); linePath.startNewSubPath (x1, y1); linePath.cubicTo (x1, y1 + (y2 - y1) * 0.33f, x2, y1 + (y2 - y1) * 0.66f, x2, y2); PathStrokeType wideStroke (8.0f); wideStroke.createStrokedPath (hitPath, linePath); PathStrokeType stroke (2.5f); stroke.createStrokedPath (linePath, linePath); const float arrowW = 5.0f; const float arrowL = 4.0f; Path arrow; arrow.addTriangle (-arrowL, arrowW, -arrowL, -arrowW, arrowL, 0.0f); arrow.applyTransform (AffineTransform::identity .rotated (float_Pi * 0.5f - (float) atan2 (x2 - x1, y2 - y1)) .translated ((x1 + x2) * 0.5f, (y1 + y2) * 0.5f)); linePath.addPath (arrow); linePath.setUsingNonZeroWinding (true); }