MCPcopy Create free account
hub / github.com/HumbleUI/Skija / drawLights

Method drawLights

examples/scenes/src/ImageFiltersScene.java:227–257  ·  view source on GitHub ↗
(Canvas canvas)

Source from the content-addressed store, hash-verified

225 }
226
227 private void drawLights(Canvas canvas) {
228 canvas.save();
229 try (Paint fill = new Paint().setColor(0xFFFF9F1B);
230 Path path = new PathBuilder().setFillMode(PathFillMode.EVEN_ODD)
231 .moveTo(10, 10).rMoveTo(20, 1.6f).rLineTo(11.7f, 36.2f).rLineTo(-30.8f, -22.4f).rLineTo(38.1f, 0f).rLineTo(-30.8f, 22.4f)
232 .build();)
233 {
234 IRect bb = IRect.makeXYWH(0, 0, 60, 60);
235 ImageFilter[] filters = new ImageFilter[] {
236 ImageFilter.makeDistantLitDiffuse( 0, 1, 1, 0xFFFF9F1B, 1, 0.5f, null, bb),
237 ImageFilter.makeDistantLitDiffuse( 0, -1, 1, 0xFFFF9F1B, 1, 0.5f, null, bb),
238 ImageFilter.makeDistantLitDiffuse( 1, 0, 1, 0xFFFF9F1B, 1, 0.5f, null, bb),
239 ImageFilter.makeDistantLitDiffuse(-1, 0, 1, 0xFFFF9F1B, 1, 0.5f, null, bb),
240 ImageFilter.makeDistantLitDiffuse(-1, -1, 1, 0xFFFF9F1B, 1, 0.5f, null, bb),
241 ImageFilter.makePointLitDiffuse(0, 0, 30, 0xFFFF9F1B, 1, 0.5f, null, bb),
242 ImageFilter.makeSpotLitDiffuse(0, 0, 30, 30, 30, 0, 1f, 30, 0xFFFF9F1B, 1, 0.5f, null, bb),
243 ImageFilter.makeDistantLitSpecular(-1, -1, 1, 0xFFFF9F1B, 1, 1.1f, 1.1f, null, bb),
244 ImageFilter.makePointLitSpecular(0, 0, 30, 0xFFFF9F1B, 1, 1.1f, 1.1f, null, bb),
245 ImageFilter.makeSpotLitSpecular(0, 0, 30, 30, 30, 0, 1f, 30, 0xFFFF9F1B, 1, 1.1f, 1.1f, null, bb),
246 };
247
248 for (var filter: filters) {
249 fill.setImageFilter(filter);
250 canvas.drawPath(path, fill);
251 canvas.translate(70, 0);
252 filter.close();
253 }
254 }
255 canvas.restore();
256 canvas.translate(0, 70);
257 }
258}

Callers 1

drawMethod · 0.95

Calls 15

makeDistantLitDiffuseMethod · 0.95
makePointLitDiffuseMethod · 0.95
makeSpotLitDiffuseMethod · 0.95
makePointLitSpecularMethod · 0.95
makeSpotLitSpecularMethod · 0.95
saveMethod · 0.80
rLineToMethod · 0.80
rMoveToMethod · 0.80
moveToMethod · 0.80
setImageFilterMethod · 0.80
restoreMethod · 0.80

Tested by

no test coverage detected