24#include <initializer_list>
30 SkScalar ambientAlpha = isAmbient ? .5f : 0.f;
31 SkScalar spotAlpha = isAmbient ? 0.f : .5f;
37 ambientColor, spotColor,
flags);
40static constexpr int kW = 800;
41static constexpr int kH = 960;
64 concavePaths.
back().
lineTo(28.867f, -16.6667f);
70 concavePaths.
back().
lineTo(-28.867f, 16.6667f);
72 concavePaths.
back().
lineTo(-28.867f, -16.6667f);
78 concavePaths.
back().
cubicTo(100, 25, 60, 50, 50, 0);
79 concavePaths.
back().
cubicTo(0, -25, 40, -50, 50, 0);
82 static constexpr SkScalar kLightR = 100.f;
94 matrices.
append()->reset();
95 matrices.
append()->setRotate(33.f, 25.f, 25.f).postScale(1.2f, 0.8f, 25.f, 25.f);
96 for (
auto&
m : matrices) {
99 for (
const auto&
path : paths) {
101 m.mapRect(&postMBounds);
118 canvas->
rotate(180, 25, 25);
129 kLightR, ambientColor, spotColor,
flags);
133 paint.setAntiAlias(
true);
142 paint.setStrokeWidth(0);
146 paint.setAlphaf(0.5f);
170 for (
auto&
m : matrices) {
172 for (
const auto&
path : concavePaths) {
174 m.mapRect(&postMBounds);
194 paint.setAntiAlias(
true);
199 paint.setStrokeWidth(0);
215 if (invCanvasM.
invert(&invCanvasM)) {
217 canvas->
concat(invCanvasM);
220 paint.setAntiAlias(
true);
254 canvas->drawRect(r, redPaint);
255 canvas->drawRect(r,
paint);
257 canvas->translate(256, 0);
259 canvas->drawRect(r, redPaint);
260 canvas->drawRect(r,
paint);
264 static constexpr SkScalar kLightR = 1.f;
268 SkPoint3 lightPos = { -45, -45, 77.9422863406f };
274 paint.setAntiAlias(
true);
280 canvas->translate(35, 35);
281 for (
int i = 0;
i < 3; ++
i) {
283 kLightR, ambientColor, spotColor,
286 canvas->translate(80, 0);
291 for (
int i = 0;
i < 3; ++
i) {
293 canvas->translate(35 + 80*
i, 105);
294 canvas->rotate(20.f*(
i + 1));
296 kLightR, ambientColor, spotColor,
304 for (
int i = 0;
i < 3; ++
i) {
306 SkScalar scaleFactor = std::pow(2.0, -
i);
307 canvas->translate(35 + 80*
i, 185);
308 canvas->scale(scaleFactor, scaleFactor);
310 kLightR, ambientColor, spotColor,
318 for (
int i = 0;
i < 3; ++
i) {
324 canvas->translate(35 + 80*
i, 265);
327 kLightR, ambientColor, spotColor,
constexpr SkColor SK_ColorLTGRAY
#define SkColorGetR(color)
#define SkColorGetG(color)
constexpr SkColor SK_ColorCYAN
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorGREEN
#define SkColorGetA(color)
#define SkColorGetB(color)
constexpr SkColor SK_ColorWHITE
@ kDirectionalLight_ShadowFlag
@ kTransparentOccluder_ShadowFlag
static constexpr bool SkToBool(const T &x)
void translate(SkScalar dx, SkScalar dy)
void rotate(SkScalar degrees)
SkMatrix getTotalMatrix() const
void drawPath(const SkPath &path, const SkPaint &paint)
void concat(const SkMatrix &matrix)
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
static sk_sp< SkColorFilter > MakeGaussian()
static sk_sp< SkShader > MakeRadial(const SkPoint ¢er, SkScalar radius, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
static constexpr int kMPersp1
input y perspective factor
bool invert(SkMatrix *inverse) const
void mapXY(SkScalar x, SkScalar y, SkPoint *result) const
static constexpr int kMPersp2
perspective bias
void setColor(SkColor color)
@ kStroke_Style
set to stroke geometry
@ kFill_Style
set to fill geometry
static SkPath RRect(const SkRRect &, SkPathDirection dir=SkPathDirection::kCW)
static SkPath Rect(const SkRect &, SkPathDirection=SkPathDirection::kCW, unsigned startIndex=0)
SkPath & moveTo(SkScalar x, SkScalar y)
SkPath & lineTo(SkScalar x, SkScalar y)
static SkPath Circle(SkScalar center_x, SkScalar center_y, SkScalar radius, SkPathDirection dir=SkPathDirection::kCW)
static SkPath Oval(const SkRect &, SkPathDirection=SkPathDirection::kCW)
SkPath & cubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3)
void setNinePatch(const SkRect &rect, SkScalar leftRad, SkScalar topRad, SkScalar rightRad, SkScalar bottomRad)
static void DrawShadow(SkCanvas *canvas, const SkPath &path, const SkPoint3 &zPlaneParams, const SkPoint3 &lightPos, SkScalar lightRadius, SkColor ambientColor, SkColor spotColor, uint32_t flags=SkShadowFlags::kNone_ShadowFlag)
FlutterSemanticsFlag flags
static float max(float r, float g, float b)
PODArray< SkColor > colors
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
void draw_shadow(SkCanvas *canvas, const SkPath &path, SkScalar height, SkColor color, SkPoint3 lightPos, SkScalar lightR, bool isAmbient, uint32_t flags)
DEF_SIMPLE_GM(shadow_utils, canvas, kW, kH)
void draw_paths(SkCanvas *canvas, ShadowMode mode)
constexpr float centerX() const
constexpr float height() const
constexpr float centerY() const
constexpr float width() const
static constexpr SkRect MakeWH(float w, float h)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)