commit
6efd2ea7e9
2 changed files with 17 additions and 6 deletions
|
@ -540,7 +540,7 @@ proc getRgbaSmooth*(
|
||||||
image: Image, x, y: float32, wrapped = false
|
image: Image, x, y: float32, wrapped = false
|
||||||
): ColorRGBX {.raises: [].} =
|
): ColorRGBX {.raises: [].} =
|
||||||
## Gets a interpolated color with float point coordinates.
|
## Gets a interpolated color with float point coordinates.
|
||||||
## Pixes outside the image are transparent.
|
## Pixels outside the image are transparent.
|
||||||
let
|
let
|
||||||
x0 = x.floor.int
|
x0 = x.floor.int
|
||||||
y0 = y.floor.int
|
y0 = y.floor.int
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import benchy, chroma, pixie, vmath
|
import benchy, chroma, pixie, random, vmath
|
||||||
|
|
||||||
block:
|
block:
|
||||||
let
|
let
|
||||||
|
@ -49,7 +49,7 @@ block:
|
||||||
a = newImage(1000, 1000)
|
a = newImage(1000, 1000)
|
||||||
b = newImage(500, 500)
|
b = newImage(500, 500)
|
||||||
a.fill(rgba(255, 0, 0, 255))
|
a.fill(rgba(255, 0, 0, 255))
|
||||||
b.fill(rgba(0, 255, 0, 255))
|
b.fill(rgba(0, rand(255).uint8, 0, 255))
|
||||||
|
|
||||||
timeIt "draw Smooth [x translate]":
|
timeIt "draw Smooth [x translate]":
|
||||||
a.draw(b, translate(vec2(25.2, 0)), bmNormal)
|
a.draw(b, translate(vec2(25.2, 0)), bmNormal)
|
||||||
|
@ -60,7 +60,7 @@ block:
|
||||||
a = newImage(1000, 1000)
|
a = newImage(1000, 1000)
|
||||||
b = newImage(500, 500)
|
b = newImage(500, 500)
|
||||||
a.fill(rgba(255, 0, 0, 255))
|
a.fill(rgba(255, 0, 0, 255))
|
||||||
b.fill(rgba(0, 255, 0, 255))
|
b.fill(rgba(0, rand(255).uint8, 0, 255))
|
||||||
|
|
||||||
timeIt "draw Smooth [y translate]":
|
timeIt "draw Smooth [y translate]":
|
||||||
a.draw(b, translate(vec2(0, 25.2)), bmNormal)
|
a.draw(b, translate(vec2(0, 25.2)), bmNormal)
|
||||||
|
@ -71,7 +71,7 @@ block:
|
||||||
a = newImage(1000, 1000)
|
a = newImage(1000, 1000)
|
||||||
b = newImage(500, 500)
|
b = newImage(500, 500)
|
||||||
a.fill(rgba(255, 0, 0, 255))
|
a.fill(rgba(255, 0, 0, 255))
|
||||||
b.fill(rgba(0, 255, 0, 255))
|
b.fill(rgba(0, rand(255).uint8, 0, 255))
|
||||||
|
|
||||||
timeIt "draw Smooth [x + y translate]":
|
timeIt "draw Smooth [x + y translate]":
|
||||||
a.draw(b, translate(vec2(25.2, 25.2)), bmNormal)
|
a.draw(b, translate(vec2(25.2, 25.2)), bmNormal)
|
||||||
|
@ -82,12 +82,23 @@ block:
|
||||||
a = newImage(1000, 1000)
|
a = newImage(1000, 1000)
|
||||||
b = newImage(500, 500)
|
b = newImage(500, 500)
|
||||||
a.fill(rgba(255, 0, 0, 255))
|
a.fill(rgba(255, 0, 0, 255))
|
||||||
b.fill(rgba(0, 255, 0, 255))
|
b.fill(rgba(0, rand(255).uint8, 0, 255))
|
||||||
|
|
||||||
timeIt "draw Smooth [rotate 45 deg]":
|
timeIt "draw Smooth [rotate 45 deg]":
|
||||||
a.draw(b, translate(vec2(0, 500)) * rotate(toRadians(45)), bmNormal)
|
a.draw(b, translate(vec2(0, 500)) * rotate(toRadians(45)), bmNormal)
|
||||||
keep(b)
|
keep(b)
|
||||||
|
|
||||||
|
block:
|
||||||
|
let
|
||||||
|
a = newImage(1000, 1000)
|
||||||
|
b = newMask(500, 500)
|
||||||
|
a.fill(rgba(255, 0, 0, 255))
|
||||||
|
b.fill(rand(255).uint8)
|
||||||
|
|
||||||
|
timeIt "draw mask Smooth [rotate 45 deg]":
|
||||||
|
a.draw(b, translate(vec2(0, 500)) * rotate(toRadians(45)), bmNormal)
|
||||||
|
keep(b)
|
||||||
|
|
||||||
block:
|
block:
|
||||||
let
|
let
|
||||||
a = newImage(100, 100)
|
a = newImage(100, 100)
|
||||||
|
|
Loading…
Reference in a new issue