2021-10-12 18:10:50 +00:00
|
|
|
import benchy, chroma, pixie, random, vmath
|
2020-11-22 00:51:29 +00:00
|
|
|
|
2020-12-09 08:28:49 +00:00
|
|
|
block:
|
2021-02-11 19:26:30 +00:00
|
|
|
let
|
|
|
|
a = newImage(1000, 1000)
|
|
|
|
b = newImage(500, 500)
|
2020-12-09 08:28:49 +00:00
|
|
|
a.fill(rgba(255, 0, 0, 255))
|
|
|
|
b.fill(rgba(0, 255, 0, 255))
|
|
|
|
|
2022-07-09 22:31:51 +00:00
|
|
|
timeIt "big-on-bigger NormalBlend":
|
2022-02-14 04:02:37 +00:00
|
|
|
a.draw(b, translate(vec2(25, 25)), NormalBlend)
|
2020-12-09 08:28:49 +00:00
|
|
|
|
2022-07-30 06:43:56 +00:00
|
|
|
block:
|
|
|
|
let
|
|
|
|
a = newImage(1000, 1000)
|
|
|
|
b = newImage(500, 500)
|
|
|
|
a.fill(rgba(255, 0, 0, 255))
|
|
|
|
b.fill(rgba(0, 255, 0, 255))
|
|
|
|
|
|
|
|
timeIt "big-on-bigger MaskBlend":
|
|
|
|
a.draw(b, translate(vec2(25, 25)), MaskBlend)
|
|
|
|
|
|
|
|
block:
|
|
|
|
let
|
|
|
|
a = newImage(1000, 1000)
|
|
|
|
b = newImage(500, 500)
|
|
|
|
a.fill(rgba(255, 0, 0, 255))
|
|
|
|
b.fill(rgba(0, 255, 0, 255))
|
|
|
|
|
|
|
|
timeIt "big-on-bigger OverwriteBlend":
|
|
|
|
a.draw(b, translate(vec2(25, 25)), OverwriteBlend)
|
|
|
|
|
2020-12-04 06:11:54 +00:00
|
|
|
block:
|
2021-02-11 19:26:30 +00:00
|
|
|
let
|
|
|
|
a = newImage(1000, 1000)
|
|
|
|
b = newImage(500, 500)
|
2020-12-04 06:11:54 +00:00
|
|
|
a.fill(rgba(255, 0, 0, 255))
|
|
|
|
b.fill(rgba(0, 255, 0, 255))
|
2020-11-26 06:32:50 +00:00
|
|
|
|
2022-07-09 22:31:51 +00:00
|
|
|
timeIt "scale x0.5":
|
2022-02-14 04:02:37 +00:00
|
|
|
a.draw(b, translate(vec2(25, 25)) * scale(vec2(0.5, 0.5)), NormalBlend)
|
2021-06-27 20:55:13 +00:00
|
|
|
|
2021-10-18 03:05:27 +00:00
|
|
|
block:
|
|
|
|
let
|
|
|
|
a = newImage(1000, 1000)
|
|
|
|
b = newImage(500, 500)
|
|
|
|
a.fill(rgba(255, 0, 0, 255))
|
|
|
|
b.fill(rgba(0, 255, 0, 255))
|
|
|
|
|
2022-07-09 22:31:51 +00:00
|
|
|
timeIt "scale x2":
|
2022-02-14 04:02:37 +00:00
|
|
|
a.draw(b, translate(vec2(25, 25)) * scale(vec2(2, 2)), NormalBlend)
|
2021-10-18 03:05:27 +00:00
|
|
|
|
2021-06-27 20:55:13 +00:00
|
|
|
block:
|
|
|
|
let
|
|
|
|
a = newImage(1000, 1000)
|
|
|
|
b = newImage(500, 500)
|
|
|
|
a.fill(rgba(255, 0, 0, 255))
|
2021-10-12 18:10:50 +00:00
|
|
|
b.fill(rgba(0, rand(255).uint8, 0, 255))
|
2021-06-27 20:55:13 +00:00
|
|
|
|
2022-07-09 22:31:51 +00:00
|
|
|
timeIt "smooth x-translate":
|
2022-02-14 04:02:37 +00:00
|
|
|
a.draw(b, translate(vec2(25.2, 0)), NormalBlend)
|
2021-06-27 20:55:13 +00:00
|
|
|
|
|
|
|
block:
|
|
|
|
let
|
|
|
|
a = newImage(1000, 1000)
|
|
|
|
b = newImage(500, 500)
|
|
|
|
a.fill(rgba(255, 0, 0, 255))
|
2021-10-12 18:10:50 +00:00
|
|
|
b.fill(rgba(0, rand(255).uint8, 0, 255))
|
2021-06-27 20:55:13 +00:00
|
|
|
|
2022-07-09 22:31:51 +00:00
|
|
|
timeIt "smooth y-translate":
|
2022-02-14 04:02:37 +00:00
|
|
|
a.draw(b, translate(vec2(0, 25.2)), NormalBlend)
|
2021-06-27 20:55:13 +00:00
|
|
|
|
|
|
|
block:
|
|
|
|
let
|
|
|
|
a = newImage(1000, 1000)
|
|
|
|
b = newImage(500, 500)
|
|
|
|
a.fill(rgba(255, 0, 0, 255))
|
2021-10-12 18:10:50 +00:00
|
|
|
b.fill(rgba(0, rand(255).uint8, 0, 255))
|
2021-06-27 20:55:13 +00:00
|
|
|
|
2022-07-09 22:31:51 +00:00
|
|
|
timeIt "smooth translate":
|
2022-02-14 04:02:37 +00:00
|
|
|
a.draw(b, translate(vec2(25.2, 25.2)), NormalBlend)
|
2021-02-11 21:05:34 +00:00
|
|
|
|
2021-06-18 02:40:07 +00:00
|
|
|
block:
|
|
|
|
let
|
|
|
|
a = newImage(1000, 1000)
|
|
|
|
b = newImage(500, 500)
|
|
|
|
a.fill(rgba(255, 0, 0, 255))
|
2021-10-12 18:10:50 +00:00
|
|
|
b.fill(rgba(0, rand(255).uint8, 0, 255))
|
2021-06-18 02:40:07 +00:00
|
|
|
|
2022-07-09 22:31:51 +00:00
|
|
|
timeIt "smooth rotate 45":
|
2022-02-14 04:02:37 +00:00
|
|
|
a.draw(b, translate(vec2(0, 500)) * rotate(toRadians(45)), NormalBlend)
|
2021-06-18 02:40:07 +00:00
|
|
|
|
2021-02-11 21:05:34 +00:00
|
|
|
block:
|
|
|
|
let
|
|
|
|
a = newImage(100, 100)
|
|
|
|
b = newImage(50, 50)
|
|
|
|
|
2022-07-09 22:31:51 +00:00
|
|
|
timeIt "shadow no offset":
|
2021-02-11 21:05:34 +00:00
|
|
|
b.fill(rgba(0, 0, 0, 255))
|
2021-09-09 03:46:49 +00:00
|
|
|
a.draw(b, translate(vec2(25, 25)))
|
2022-07-30 03:01:47 +00:00
|
|
|
discard a.shadow(
|
2021-02-11 21:05:34 +00:00
|
|
|
offset = vec2(0, 0),
|
|
|
|
spread = 10,
|
|
|
|
blur = 10,
|
|
|
|
color = rgba(0, 0, 0, 255)
|
|
|
|
)
|
2021-11-23 09:15:58 +00:00
|
|
|
|
|
|
|
block:
|
|
|
|
let
|
|
|
|
a = newImage(100, 100)
|
|
|
|
b = newImage(50, 50)
|
|
|
|
|
2022-07-09 22:31:51 +00:00
|
|
|
timeIt "shadow with offset":
|
2021-11-23 09:15:58 +00:00
|
|
|
b.fill(rgba(0, 0, 0, 255))
|
|
|
|
a.draw(b, translate(vec2(25, 25)))
|
2022-07-30 03:01:47 +00:00
|
|
|
discard a.shadow(
|
2021-11-23 09:15:58 +00:00
|
|
|
offset = vec2(10, 10),
|
|
|
|
spread = 10,
|
|
|
|
blur = 10,
|
|
|
|
color = rgba(0, 0, 0, 255)
|
|
|
|
)
|