#include
SkPath path; path.moveTo(10, 10); path.lineTo(100, 10); path.lineTo(100, 50); path.lineTo(10, 50); path.close(); SkPaint paint; paint.setStyle(SkPaint::kStroke_Style); paint.setStrokeWidth(2); canvas->drawPath(path, paint);
SkPath path; path.addCircle(50, 50, 40); path.close(); SkPaint paint; paint.setStyle(SkPaint::kFill_Style); SkRect rect = { 0, 0, 100, 100 }; SkShader* shader = SkGradientShader::MakeRadial( {50, 50}, 40, {0xFFFFFFFF, 0xFFFF0000}, nullptr, 2, SkTileMode::kClamp_TileMode); paint.setShader(shader); canvas->drawRect(rect, paint);This example creates a circular path with a center at (50,50) and a radius of 40. We then close the path and fill it with a gradient color using a SkShader object. We define the gradient colors, tile mode, and center position in the SkGradientShader::MakeRadial() function. Overall, the SkPath and close() function are part of the Skia graphics library, which is available as a C++ library and can be included in projects as a package or library.